Search This Blog

Tuesday, June 27, 2017

Ford EL and AU ECU location

Anyone Googling this and getting horrible results like this the answer is the passenger side kick panel. I should have guessed this because it's the same for a Nissan Skyline.

Tuesday, May 23, 2017

Find and remove duplicate files in Linux

After maintaining data for years and guessing I have terrabytes of duplicated data. I couldn't find a great solution so I made my own using fdupes.


Firstly, use eyeballs to ensure there will not be any problems:


fdupes -rnm .

If all seems well then remove the duplicates:


fdupes -rndN .

I'm sure this can be approved on. The fundamental concept here is to determine if there is going to be any problems before automatically deleting a bunch of files.




Monday, March 27, 2017

Install Google Assistant

I'm currently running a Moto G3 with Marshmallow and Google Now. My Google Now feed has been bombarded with articles about how I'm going to get Google Assistant for over five months now and as an Australian I thought it would have happened already. Despite what you may read, it isn't going to happen automatically and this article describes how to make it happen.

Firstly you should try Google Assistant via Google Allo to determine if you want it in the first place. Personally I ask AI systems "who shot first" to determine their quality. Google Assistant's comments about Chewbacca impressed me enough to make the switch.

A word of warning you won't find on the web: this process will destroy your launcher configuration and means you'll have to set up all your icons and widgets again. If you've ever moved from Lollipop to Marshmallow this is something you have become accustomed to anyway.

Are you ready to do this? Let's go!

Step 1: Make your phone American (it's only temporary). Go to settings then "Language & input".

Now change your language to English (United States).

Step 2: Kill Google. In settings go to Apps.

Now wait forever and find the "Google App".
Then go to Storage, Manage Space
And now click "Clear All Data".
Now go back to Apps and repeat the process for "Google Play services".

Step 3: Configure Google Assistant and rebuild the universe. Go back to your home screen and you should notice it has been destroyed. Swipe right to where Google Now was and it will ask to configure Google Assistant. Do this and rebuild your launcher icons and what not.

Step 4: Get the hell out of Dodge. Remember to go back to settings, "Language & input" and change your language back to English (Australia) or whatever. You'll have to keep your language as English (United States) or Google Assistant will stop working.

Monday, October 24, 2016

Krush, Kill 'n' Destroy rfkill

Awesome!!!


rfkill is the worst piece of software ever conceived, in a nutshell it is designed to completely destroy radio (eg. WiFi / BlueTooth / etc) right when you need it most. Why anyone would think that you would need to do this is beyond me (I'm not buying the "it uses less battery" argument, using a shot gun would be more elegant). Whoever though this needed to be installed by default in all Ubuntu distro's needs a mental health plan.


After dealing with years and years of agonizing pain because of this I found an elegant solution, remove it:


sudo apt-get purge --auto-remove rfkill

No more USB cables, booting Windows, and command line ninja mastery, this works! Even if you accidentally hit that mysterious checkbox in NetworkMananger the radios do not die.


I'd also like to thank the genius who though it would be a good idea to add "connect" buttons to network connections in the latest version NetworkMananger, you are a true visionary!

Wednesday, October 19, 2016

Upgrade adoptable USB storage in Android Marshmallow

Yeesh!


I'm writing this guide for myself because I can't find much on the Internet about this. I haven't even tried this, I'm making it up as I go but trust me this is going to work or there will be blood.


  1. Install App2SD on the phone
  2. Backup app list using App2SD
  3. Disable USB debugging (if necessary)
  4. Set the USB mode to MTP (if necessary)
  5. Plug the phone directly into a PC (no USB hub)
  6. Browse to the SD contents:
    • If you are using Windows or a Mac, just do it
    • In KDE look in Dolphin's "places"
    • If you use GNOME put on your big boy pants
    • If you use Unity, check yourself into rehab
    • Or see 2
  7. Copy the SD contents to the PC12
  8. Switch off the phone
  9. Replace the old SD card with the new one
  10. Boot the phone
  11. Tell Android to delete the old SD card and pray
  12. Format and migrate to the new SD card
  13. Reboot the phone
  14. Copy the backed up data to the new SD card (I needed a File Manager and AirDroid for this)2
  15. Re-install App2SD
  16. Use Superman strength to replace the App2SD backup with the actual backup3
  17. Use app restore in App2SD to manually confirm to install each and every missing app
  18. Reboot the phone
  19. Put everything back to normal. 99% of apps will have fully restored data, use Superman strength for the 1%
  20. Try not to kill anyone

Easy huh?


Update


I'm thinking my OTG cable could have really helped with this.

Saturday, October 15, 2016

tmuxstart

I use tmux because it is rather awesome and I have spent quite a bit of time developing a script to automate starting it. It uses screen compatible key bindings to help with muscle memory. It should just work on debian and be easy to adapt for redhat and others.


I'm not happy with the mouse mode component because it wrecks my OS clipboard functionality so I've still got some work to do (help?). With this much effort it would be a shame to not share it so here it is.


#!/bin/bash
echo
# first window is called console, top 60% is bash
tmux new-session -d -n console -s default
# remap prefix to Control + a
tmux set -g prefix C-a
tmux unbind C-b
tmux bind C-a send-prefix
# windows start at '1'
set -g base-index 1
# allow resize
tmux setw -g aggressive-resize on
# allow mouse mode
tmux set -g mode-mouse on
tmux set -g mouse-resize-pane on
tmux set -g mouse-select-pane on
tmux set -g mouse-select-window on
# lower left 50% x 40% is logs
tmux split-window -p 40 'bash -c "tail -Fn20 /var/log/syslog"'
# lower right 50% x 40% is htop
tmux split-window -h htop
# window for work (bash)
tmux new-window -c ~/Documents/Projects/ -n work
# window for root
tmux new-window -n root 'sudo su -'
# window for htop
tmux new-window -n htop 'htop'
# window for syslog 
tmux new-window -n syslog 'bash -c "tail -Fn20 /var/log/syslog"'
# focus on desired window
tmux selectw -t 0
tmux selectp -t 0
# wish I could remember what this does
tmux a -t default

Wednesday, October 05, 2016

Google Now API

I've been wondering about how to do custom integrations with Google Now for quite a while and have finally found the documentation:

https://developers.google.com/schemas/reference/

Thank you Private Public Transport Victoria for finally coming around. I'd like to shout out to the AFL and point out that an AFL match is an "event", much like an NRL or cricket match really.

Tuesday, October 04, 2016

#GoogleTranslate

Does anyone know the nerd from the Google Translate ad? I can't find the ad and keep thinking about it. The letters in his zipper and hair just need to go through a SOUNDEX and a dictionary before being thrown out. More false negatives will need to be dealt with but a whole lot less false positives. The false negatives can be improved by optimizing detection of known non-dictionary items like numbers.

Thursday, August 04, 2016

Aptitude

I have fixed this but it is really comforting to know that Canonical can get aptitude working in Windows 10 but not in Ubuntu
E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable)

Sunday, July 17, 2016

blueproximity KDE

Not sure why:

rfkill unblock bluetooth

Configure:

  • Lock command:
    qdbus org.kde.screensaver /ScreenSaver Lock
  • Unlock command:
    qdbus | grep kscreenlocker_greet | xargs -I {} qdbus {} /MainApplication quit
  • Proximity command:
    qdbus org.freedesktop.ScreenSaver /ScreenSaver SimulateUserActivity

From here!

Tuesday, May 03, 2016

PulseAudio why so hard

The type of application I want to use is one where sound comes out of speakers. I have another where I'd like sound to come in through the microphone but I don't want to ask for too much.

:~ > pacmd
No PulseAudio daemon running, or not running as session daemon.
:~ > ps aux | grep pulse
pulse    30519  0.0  0.1 479048  8824 ?        S 

Sunday, September 27, 2015

Ok Internet

I suck at BASH scripting but make myself do it anyway. Even though I'm not supposed to go near toy ponies, today I wrote this for Ubuntu:

/usr/local/sbin/ponyfortune:
#!/bin/bash
N=0;
while true; do
        N=$((N+1));
        P=`ponysay -l | sed -r "s:\x1B\[[0-9;]*[mK]::g" | sort -R | head -n1 | tr -s ' ' | tr ' ' '\n' | head -n3 | sort -R | head -n1 | tr -d ' '`;
        printf "$N) $P says:\r\n";
        fortune -s | ponyfy | ponysay -F $P | pv -qL750;
done;

I took the following from milesluigi @ reddit:

/usr/local/sbin/ponyfy:
#!/bin/bash
sed -e 's/america/amareica/g' -e 's/America/Amareica/g' -e 's/anybody/anypony/g' -e 's/Anybody/Anypony/g' -e 's/anyone/anypony/g' -e 's/Anyone/Anypony/g' -e 's/boy/colt/g' -e 's/Boy/Colt/g' -e 's/butthurt/saddle-sore/g' -e 's/Butthurt/Saddlesore/g' -e 's/children/foals/g' -e 's/Children/Foals/g' -e 's/child/foal/g' -e 's/Child/Foal/g' -e 's/cowboy/cowpony/g' -e 's/Cowboy/Cowpony/g' -e 's/cowgirl/cowpony/g' -e 's/Cowgirl/Cowpony/g' -e 's/gentlemen/gentlecolts/g' -e 's/Gentlemen/Gentlecolts/g' -e 's/everybody/everypony/g' -e 's/Everybody/Everypony/g' -e 's/everyone/everypony/g' -e 's/Everyone/Everypony/g' -e 's/feet/hooves/g' -e 's/Feet/Hooves/g' -e 's/folks/foalks/g' -e 's/Folks/Foalks/g' -e 's/fool/foal/g' -e 's/Fool/Foal/g' -e 's/foot/hoof/g' -e 's/Foot/Hoof/g' -e 's/girls/fillies/g' -e 's/Girls/Fillies/g' -e 's/girl/filly/g' -e 's/Girl/Filly/g' -e 's/halloween/nightmare night/g' -e 's/Halloween/Nightmare Night/g' -e 's/hands/hooves/g' -e 's/Hands/Hooves/g' -e 's/handed/hooved/g' -e 's/Handed/Hooved/g' -e 's/hand/hoof/g' -e 's/Hand/Hoof/g' -e 's/\bhey\b/hay/g' -e 's/\bHey\b/Hay/g' -e 's/humans/ponies/g' -e 's/Humans/Ponies/g' -e 's/human/pony/g' -e 's/Human/Pony/g' -e 's/ladies/fillies/g' -e 's/Ladies/Fillies/g' -e 's/main/mane/g' -e 's/Main/Mane/g' -e 's/woman/mare/g' -e 's/Woman/Mare/g' -e 's/women/mares/g' -e 's/Women/Mares/g' -e 's/\bman\b/stallion\ /g' -e 's/\bMan\b/Stallion/g' -e 's/\bmen\b/stallions/g' -e 's/\bMen\b/Stallions/g' -e 's/no\ one\ else/no\ pony\ else/g' -e 's/No\ one\ else/No\ pony\ else/g' -e 's/nobody/nopony/g' -e 's/Nobody/Nopony/g' -e 's/people/ponies/g' -e 's/People/Ponies/g' -e 's/person/pony/g' -e 's/Person/Pony/g' -e 's/philadelphia/fillydelphia/g' -e 's/Philadelphia/Fillydelphia/g' -e 's/somebody/somepony/g' -e 's/Somebody/Somepony/g' -e 's/tattoo/cutie\ mark/g' -e 's/Tattoo/Cutie\ mark/g' -e 's/the\ heck/the\ hay/g' -e 's/The\ heck/The hay/g' -e 's/the\ hell/the\ hay/g' -e 's/The\ Hell/The\ Hay/g' -e 's/troll/parasprite/g' -e 's/Troll/Parasprite/g'

To install:
sudo add-apt-repository ppa:vincent-c/ponysay
sudo apt-get update
sudo apt-get install ponysay fortune pv

The "P=" line basically asks ponysay to get a list of pony's it knows about, picks one at random, pivots that and does it again because there are three ponies per line to get the name of a random pony. Next it ponyfy's a fortune quote and uses pv to make it render slowly.

Sunday, July 05, 2015

Tuesday, June 16, 2015

Wednesday, June 10, 2015

Big guns for fun

I've had some free time lately and I decided to adapt a scrolling shoot em up style game to have what everyone really wants, insanely powerful weapons. I found a good Java game to adapt and modified it until I was happy with the result. Update: I'm getting into github.

Thursday, September 05, 2013

BASH question

I have a slightly old Ubuntu based distro with a slightly new wifi card that has never had a working wifi driver so I've been having to bake my own. Of course every time a new kernel comes out I have to recompile it with my own wifi driver.

When, say, I'm on a moving train and I update my system, which in turn updates the kernel which then kills my wifi, which then requires me to download the latest headers to re-compile the wifi driver into the kernel, it feels a lot like my own personal hell. I've learned to deal with it by adopting the mantra "dealing with Linux drivers is like going to war armed with a teaspoon".

To save me a lot of pain, I have a BASH script that compiles the driver into the kernel and starts it etc. I also have a custom alias that updates my system, it runs apt-get update, apt-get dselect-upgrade etc, and the second last and important thing it does is download the current kernel headers. I do it with this:

apt-get install linux-headers-`uname -r`

Running this command in a console does the job fine. But within my alias, it seems to grep a whole lot of crap back into it somehow, and I get what feels like a thousand different messages like:

Note, selecting 'libcpan-uploader-perl' for regex 'tree...'

I'd love to know why this happens, I'd probably be able to stop it if I knew why. I'm sure it has something to do with running a sub-command from within an alias. If you know BASH well and can explain this to me I'd greatly appreciate it. I expect most Linux users will ask why the f**k I use BASH and Windows users will ask what the f**k is BASH.

Here are the relevant parts of my ~/.bashrc :

alias nomnomnom='echo Updating repository...
echo
sudo apt-get -yu update
echo
echo Upgrading....
echo
sudo apt-get -yfu dselect-upgrade
echo
echo Updating kernel headers...
echo
sudo apt-get install linux-headers-`uname -r`
echo
echo Cleaning up...
echo
sudo apt-get -yu autoclean
sudo apt-get -yu autoremove
echo Done.
'


alias fixwifi='echo Shutting down WiFi...
sudo ifconfig wlan0 down
echo Making...
cd /usr/local/src/rtl8723
make
echo Installing...
sudo make install
echo Restarting WiFi...
sudo modprobe rtl8723e
sudo modprobe -r rtl8723e
sudo modprobe rtl8723e ips=0
sudo ifconfig wlan0 up
echo Done.
sudo ifconfig wlan0
cd $OLDPWD
'


UPDATE:
I've come to the conclusion that backticks in an alias are just plain buggy in BASH so I've moved the alias to /blah/bin/nomnomnom and it just works now.

Friday, August 09, 2013

Minecraft fixed

Linux Notebook / Netbook users, I a have solution that will stop you from accidentally smashing your bed to pieces after waking up in the morning or pouring molten lava everywhere when you are interior decorating! Here is my /usr/local/games/minecraft:

#!/bin/bash

# Chris' Minecraft launcher
#
# see:
# xinput list
# xinput list-props

# Disable synaptics touchpad tap
xinput set-int-prop 12 279 8 0 0 0 0 0 0 0

# Disable synaptics touchpad scrolling
xinput set-int-prop 12 270 8 0 0 0
xinput set-int-prop 12 271 8 0 0

# Start Minecraft
java -Xmx1024M -Xms512M -jar /usr/local/games/Minecraft.jar

# Enable synaptics touchpad tap
xinput set-int-prop 12 279 8 2 3 0 0 1 3 0

# Enable synaptics touchpad scrolling
xinput set-int-prop 12 270 8 1 0 0
xinput set-int-prop 12 271 8 1 0

Tuesday, June 04, 2013

Maybe I do want a tablet

I'd be very interested if some one out there with too much time and money could take the time to post some photos of KDE running on the new Microsoft Surface Pro. I haven't seen the point in owning such a device due to the lack of useful features but getting a full blown Linux on it would be a different story.

Monday, May 27, 2013

NTFS -> USB -> Debian -> ?

Over the weekend I got spoiled with some time to myself and felt really good because I caught up on some chores and got to sleep in. Yesterday I decided it was about time I spent some time trying out the kids PS3 and see what it could do other than play games and DVD's. I'm at that "middle age" part of my life where I don't have the time or the interest to really get into games or consoles so I really don't know a lot about PS3's. Most of the gaming I do is with Sam who's really more into Nintendo, Flash games, and Android when he gets on my phone.


So with a bit of help from Google and some tinkering I got Windows XP MCE whoring it's media to the PS3 and was really impressed with having the ability to slump on the couch and browse through mindless amounts of local media and have it just play on a big TV (Hint for Windows users: you need to configure Windows Media Player (not Windows Media Center) to make it work as a Media Center).


So the next natural step for me was to make my Linux boxen work as a DLNA server. My first choice was a good one, minidlna, because it's available in aptitude, has no pointless GUI and "just works". Of course with most things you're trying for the first time in Linux, it doesn't "just work" until you've figured out how to configure it properly. I could tell that minidlna was working fine but couldn't find anything on my NTFS USB drive. After a bit of Googling and not getting anywhere I remembered I had the same issues with Samba. When I was less experienced I used to solve these issues by customizing fstab but nowadays I'm pretty sure there's better solutions for (un)pluggable USB disks than putting permanent entries in fstab.


The solution I use for Samba and minidlna now is to force it to run as me. It's probably not the best solution but it's easy to do and really works. The reason for this is auto-mounted NTFS drives are owned by the current user and have no access for groups or other users. From what I can tell hacking the udev configuration is a better solution but that seemed way too much like brain surgery for a Sunday afternoon.


With the amount of my life I've wasted on issues with NTFS USB drives on Debian I've decided to share this solution with you all. I'm 90% sure it's not the best solution and probably has some security issues buts it's simple, fast, and doesn't interfere when the drives are disconnected when you're booting.


Here's what I did to /etc/samba/smb.conf:


[global]

# Hack to make USB devices sharable
force user = chris

And this is what I did to /etc/init.d/minidlna:


# Run as `minidlna' if USER is not specified or is `root'
if [ -z $USER ]; then
        #USER=minidlna
        USER=chris
fi

Please let me know if you know a better way to deal with auto-mounted NTFS 600/700 permission crap.

Sunday, December 06, 2009

Fixed my web site

After a few years of upgrades to the hosting of my web site (PHP 4.2->5.0->5.1->5.2) and expected changes on the world wide web my site became pretty broken. I can now proudly say I have fixed most of the bugs on this site. The biggest problem was updating how I was aggregating news feeds, I only had to update my code to support RSS 0.91/2.0, RSS 1.0, RDF, ATOM "channel", and ATOM "entry". Yay for standards.

Monday, June 29, 2009

I need to vent

Grr, f***, sh**, a** f***! I am setting up one of my PHP CMS's and was having trouble with non-ASCII characters. After pulling my hair out and endless googling I found the problem, htmlentities(). It turns out that htmlentities() is set to ISO-8859-1 by default and needs a specific parameter to be UTF-8.

I found this:

/**
 * Encodes HTML safely for UTF-8. Use instead of htmlentities.
 *
 * @param string $var
 * @return string
 */
function html_encode($var)
{
 return htmlentities($var, ENT_QUOTES, 'UTF-8') ;
}

Here:
http://developer.loftdigital.com/blog/php-utf-8-cheatsheet

Tuesday, July 08, 2008

Coco Contacts

A friend of mine has created this site that sells freaking cool contact lenses. I've seen fashion / colored contacts before but Coco Contacts has a huge range of really cool eye contacts that I've never seen before such as soccer balls and smiley faces.

Personally I'd like to get some for the next Halloween / StarWars / cross-dressing party I attend.

Friday, September 30, 2005

New blog from blogger.com

I have got myself a new blog thanks to blogger.com. I have set it up so it can be viewed directly from my web site and anyone can make comments. Comments won't appear directly on the web site until they have been approved and comments may be removed if they are deemed inappropriate.