Category: How Tos

How to speed up compiling in Manjaro or Arch Linux with a AMD Ryzen CPU

Edit /etc/makepkg.conf. That is assuming you are using makepkg.

Add “MAKEFLAGS=’-j17′” to it.

And be amazed at how fast it compiles stuff.

Did it take less then 10 minutes? If so, it was well worth the money.

And I have to restart, because they haven’t updated the PKGBUILD, you have to rename something. I waited for ten minutes or less for nothing.

Recompiling didn’t take long. Don’t think it actually recompiled.

How to fix Jetpack if using NGINX as a proxy

Add “set_real_ip_from 192.168.122.1;” on the backend, to the nginx.conf file. Under http. Replace the IP with the proxy’s IP. Stolen from here.

Editing wp-config.php with their hack, didn’t work for whatever reason.

if ( !empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
  $forwarded_ips = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
  $_SERVER['REMOTE_ADDR'] = $forwarded_ips[0];
  unset( $forwarded_ips );
}

You can try that if you can’t change your web server’s config.

Just realized, fastcgi might of cached it. So purging the cache, could of made the wp-config.php hack work. I also tried changing it to the X-Real-IP header.

You can upgrade to Android 7/EMUI 5 before it says there’s an update

My internet is slow, still downloading the zip files.

update.zip B360
update_data_full_hw_usa.zip B360

The update.zip file was found here, and the URL was modified for the update_data_full_hw_usa.zip.

If using Linux, you can use mitmproxy. Or you can use Charles Proxy, instructions here.

Don’t know how to do it in mitmproxy, if it only shows stuff, but doesn’t allow you to change anything, then it won’t work.

Wait a second, why do you have to download it manually? Think somebody said you don’t.

The B60 response is below.

{
"status": "0",
"autoPollingCycle": "1",
"components": [{
"name": "FRD-L04C567B360-OTA",
"version": "FRD-L04C567B360",
"versionID": "72309",
"description": "å• †ç”¨å‘布: [全量包] FRD-L04C567B162 至 FRD-L04C567B360 (2017/01/03)",
"createTime": "2017-01-03T03:18:12+0000",
"url": "http://update.hicloud.com:8180/TDS/data/files/p3/s15/G1278/g104/v72309/f1/"
}]
}

Good luck using mitmproxy. You might have to write a script.

Update
The script finally works.

"""
This example shows how to send a reply from the proxy immediately
without sending any data to the remote server.
"""
from mitmproxy import http
import json
class Honor_Updater:
	def __init__(self):
		with open('update.txt') as data_file:    
			self.json = json.load(data_file)	
			
	def request(self, flow):
		# pretty_url takes the "Host" header of the request into account, which
		# is useful in transparent mode where we usually only have the IP otherwise.
		if flow.request.pretty_url == "http://query.hicloud.com/sp_ard_common/v2/Check.action?latest=true&ruleAttr=true&verType=true":
			flow.response = http.HTTPResponse.make(
				200,  # (optional) status code
				str(self.json).encode("utf8"),  # (optional) content
				{"Content-Type": "application/json"}  # (optional) headers
			)
			
def start():
    return Honor_Updater()

That’ll let you update your Honor 8. To use type mitmdump -s “update.py” -p 8080, then use your computer as a proxy on your phone, go to WiFi, then touch the network until you get a popup. Modify the network.

I forgot to disconnect from the proxy, so I had to reboot my phone.

And it’s downloading, sweet.

Oh yeah, put the below in a file called update.txt.

{
"status": "0",
"autoPollingCycle": "1",
"components": [{
"name": "FRD-L04C567B360-OTA",
"version": "FRD-L04C567B360",
"versionID": "72309",
"description": "å• †ç”¨å‘布: [全量包] FRD-L04C567B162 至 FRD-L04C567B360 (2017/01/03)",
"createTime": "2017-01-03T03:18:12+0000",
"url": "http://update.hicloud.com:8180/TDS/data/files/p3/s15/G1278/g104/v72309/f1/"
}]
}

In the same folder as update.py.

See, you don’t need a paid program to do it. Just Linux.

If you forget to disable the proxy, before clicking update, just reboot, and it’ll start downloading as soon as it boots up.

You can download the script and the txt file below.

update_honor_8.zip

You can get mitmproxy for Windows too.

How to use the NVIDIA driver with a PCIe x1 710 and a AMD video card in the first PCIe x16 slot

Install the NVIDIA driver, “sudo mhwd -i pci video-nvidia”.

Then edit /etc/mkinitcpio.conf, remove “nouveau” from the MODULES line.

Then run “sudo mkinitcpio -p linux48”, change 48 to the version of your kernel, 44 is the default that comes with Manjaro.

Look in the /etc/X11/mhwd.d/nouveau.conf file, you need the BusID line.

Add BusID “PCI:5:0:0” or whatever your BusID line is, to the /etc/X11/mhwd.d/nvidia.conf. It goes in the Device section, under Driver “nvidia”.

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    BusID       "PCI:5:0:0"
    VendorName     "NVIDIA Corporation"
	Option "NoLogo" "1"
EndSection

Then reboot, and it should work.

This assumes you already blacklisted the amdgpu driver.

How to passthrough the video card in your main PCIe x16 slot to a QEMU virtual machine

Not for using a single video card, I put a cheap NVIDIA PCIe x1 card in my computer. You use the NVIDIA with Linux, and the AMD for Windows.

Using the integrated GPU isn’t the solution, no overclocking if you do that. Except, you get no sensor data if overclocking a non K series Intel CPU.

If both cards, are the same brand, I can’t help you. Also, you should already have the PCIe x1 card working.

Upgrading the kernel may or may not be needed. I’d use at least 4.8. I did upgrade, but I don’t think that’s what fixed it.

You need to edit /etc/default/grub:

iommu=pt intel_iommu=on modprobe.blacklist=amdgpu video=efifb:off

Add that to the “GRUB_CMDLINE_LINUX_DEFAULT=” line.

Then run sudo update-grub.

Assuming you are using libvirt, add the below to the section for your video card, in the /etc/libvirt/qemu/win10.xml file.

<rom file='/home/user/Downloads/MSI.RX470.4096.160818.rom' />

The full section in my xml file looks like the below:

    
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <rom file='/home/user/Downloads/MSI.RX470.4096.160818.rom' />
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </hostdev>

If you upgraded the kernel, you’ll need to remove your USB devices and the video card, and re add everything, otherwise you’ll get an error. Also, you might need to change the CPU.

You can find the ROM file for your video card here. Or you can boot Windows, and use GPU-Z and get it from that.

VGA passthrough didn’t work with whatever kernel Manjaro uses by default. Even with the integrated video.

Might be easier if your bios lets you specify which PCIe card is the primary card. My bios only has integrated or PCIe. No way to say which card to boot from. It boots from the AMD card, so if I need to enter the bios, I have to change the input on my monitor.

I assume, you already had VGA passthrough working. If not, you can go to Arch Linux’s Wiki, or search Google.

How to send Windows audio to your Linux computer over the network

Are you using Windows in a KVM virtual machine? You might notice the CPU usage is high if you use KVM’s audio. Use Stream What You Hear, it’s free. Install it in Windows, and then use VLC or any other media player, to play the stream, or you can try setting up UPnP/DLNA.

There is a delay, at least in the HTTP streaming. I don’t really care. Better then using a USB sound card, plugged into my computer’s internal sound card’s line in port. Doesn’t sound that great, and if there’s no audio, you can hear a noise like your ear’s ringing.

Airfoil Speakers doesn’t work in Manjaro. Gets a nice error message and closes, probably because it was written with an old version of Mono. I’m not installing an old Ubuntu version to use it. Also, it costs 30 bucks. If they can’t make a working Linux speaker program, then I’m not buying the Windows software.

Update
You have to have a sound card for it to work, my HDMI sound from my AMD video card doesn’t work for some reason. So I had to plug the damn USB sound card back in. Didn’t work plugged into my USB 3.0 hub. Had to plug it in on the back of my computer, where it was. The keyboard for some reason didn’t work with the USB sound card plugged into the hub. So I couldn’t login.

Update
A media renderer might be worse. I compiled gmrender-resurrect. Instructions for an old Ubuntu here. If using Manjaro, you only need to install gstreamer0.10-ffmpeg, it’ll compile without it, but it won’t work. Easier then manually running VLC. So I’ll use it.

Update
Don’t use gmrender-resurrect. It is choppy. VLC works better, using an HTTP stream. Also, you have to try connecting, won’t work, disconnect, connect again, and it’ll work. So, you might not need ffmpeg. Or maybe recompiling with ffmpeg installed makes it work better. I’ll just use VLC.

The Stream What You Hear might be what’s choppy. The HTTP stream was having issues too. Restarted Stream What You Hear, and it might be better.

How to make a Ubuntu chroot in Arch Linux or Manjaro Linux

Use debootstrap.

sudo pacman -S debootstrap

Don’t follow the instructions on Ubuntu’s site, their deboostrap doesn’t work with Manjaro Linux or Arch Linux.

sudo debootstrap --variant=buildd --arch amd64 trusty /ubuntu http://mirror.pnl.gov/ubuntu/

That’s the command I just used, Airfoil Speakers probably requires an old Ubuntu version. I tried the newer version the first time.

mount -o bind /dev /ubuntu/dev
mount -o bind /proc /ubuntu/proc
mount -o bind /sys /ubuntu/sys
chroot /ubuntu

Then after you are in, run “export PATH=”$PATH:/usr/sbin:/sbin:/bin””. Then install nano, and put that in the /etc/profile file.

Good luck, you need a virtual machine for Airfoil Speakers.

If compiling Mono GIT doesn’t work, then I give up. No audio in Windows for me. Screw that, use Stream What You Hear.

It’ll give you an URL, that you can play in VLC. Don’t need to install anything to do that, VLC already is.

It works, and it might have a delay, which is a bummer. Good enough.

Convert Windows 1Password 6 txt file to generic CSV file for importing in LastPass

The script finally works. Don’t try to use math to get the website address, I think every exported entry has a website=, so you don’t have to be smart to figure out which line website is on.

s = "url,type,username,password,hostname,extra,name,grouping\n"
users = []
pass = []
hostname = []
namey = []
tn = 0
stuff = []

File.open(ARGV[0], "r") {|f|
	f.each_line do |line|
		if line.start_with?("\r")
			tn = tn + 1
		else
			if stuff[tn].nil?
				stuff[tn] = line.to_s
			else
				stuff[tn] += line.to_s
			end
		end
	end
}
stuff.each { | itemy | 
	if !itemy.nil?
		t = []
		t = itemy.split(/\n/)
		en = t.count - 1
		n = 0
		if t
			t.each { | bla |
				t2 = bla.split("=", 2)
				diff = en - n
				t2[0] = t2[0].to_s.gsub(/\r|\n/m, "")
				t2[1] = t2[1].to_s.gsub(/\r|\n/m, "")
				if n != 0
					if diff == 1 && t2[0] != "password"
						users[stuff.index(itemy)] = t2[1]
					elsif en == n && t2[0] != "username"
						pass[stuff.index(itemy)] = t2[1]
					elsif t2[0] == "website"
						hostname[stuff.index(itemy)] = t2[1]
					elsif n == 1
						namey[stuff.index(itemy)] = t2[1]
					end
				end
			n = n + 1
			}
	end
	end
}
n = 0
while n <= tn do
	if hostname[n].nil?
		if pass[n] == pass[n - 1]
			hostname[n] = hostname[n - 1]
			namey[n] = namey[n - 1]
		end
	end
	if "#{hostname[n]},,#{users[n]},#{pass[n]},#{hostname[n]},,#{namey[n]}," != ",,,,,,,"
		s += "#{hostname[n]},,#{users[n]},#{pass[n]},#{hostname[n]},,#{namey[n]},"
		s += "\n"
	end
	n = n + 1
end 
File.open(ARGV[1], "w") {|f|
	f.write(s)
}
print "Saved #{tn} to #{ARGV[1]}\n"

There’s the Ruby script to convert it. If it doesn’t work, you can fix it. If you run it in Windows, use Bash. Or find a Windows build of Ruby.

Had to change my dediserve password, the password I imported didn’t work. I deleted the txt file already, so I can’t see what it is in there. Also uninstalled 1Password, and I’m not in Windows.

Don’t use that script, Amazon password is wrong too. Has www.amazon.com instead of a password. Another password to reset.

No cPanel login for my BuyShared hosting. Tried resetting, but no email yet.

Don’t use BuyShared, if you might lose the password. I had to go into Windows, and login to 1Password in Chrome, and copy the password. BuyShared disabled all email apparently.

The script doesn’t like certain characters. You could try removing the .to_s.gsub.

LastPass’s password generator blows. The password I copied and pasted, is wrong, can’t login.

Update
Updated the code to limit the split to 2. That might fix it. I’m assuming the passwords that aren’t all there, have an equals sign.

Sound finally works

You have to change a setting in /etc/libvirt/qemu.conf, change the host audio or whatever it’s called to 1. Then change the xml file. You have to add four environment variables to it.

QEMU_AUDIO_DRV=pa
QEMU_PA_SAMPLES=8192
QEMU_AUDIO_TIMER_PERIOD=99
QEMU_PA_SERVER=/run/user/1000/pulse/native

Can’t remember the location of the XML file. But to add custom environment variables, instructions here. Those variables were stolen from Linux Mint’s forum.