Favorite gnome shell extensions


  • “No topleft hot corner” — Prevents the activities view when you mouse-over the  activities button
  • “Panel world clock” — Always set to GMT
  • “Pomodoro” — A simple pomodor timer
  • “Put windows” — super-arrow keys, super num keys to move windows around to different regions
  • “Workspace Grid” — (When it works,) lets you rearrange the workspace layout
  • “Mulitple monitor panels” — (When it works, ) displays window previews on both screens instead of just one.

 

 

 

Posted in Uncategorized | 1 Comment

Cheats to ignore files in git


I have this clump in my ~/.bashrc …

This provides the following commands:

git-ignore /some/filename/
git-unignore /some/file/name
git-unignore-all
git-ignore-list

##
## Git stuff, helpers
##
git config --global user.name AndyO
git config --global core.excludesfile ~/.gitignore
git_ignore () 
{ 
 if grep -e "^$1\$" ~/.gitignore; then
 echo $1 already ignored;
 else
 echo $1 >> ~/.gitignore;
 fi
}
git_unignore ()
{
 sed -e "/^$( sed -e 's/[]\/()$*.^|[]/\\&/g' <<< $1 )\$/d" ~/.gitignore -i
}
alias git-ignore=git_ignore
alias git-ignore-list='cat ~/.gitignore'
alias git-unignore=git_unignore
alias git-unignore-all='( > ~/.gitignore)'

If you desired, you could easily change the functions to loop over $@ to allow the user to provide more than one filename at a time.

Posted in Uncategorized | Tagged | Leave a comment

Practical use of LXC in Arch Linux in March of 2013


I’m writing this for myself in hopes that it benefits somebody else. The guides that I’ve found on LXC have been either unholy scatterbrained or just out of date.

Starting from scratch.

If you’re fairly new to arch as I am, keep in mind that if you hit your head on anything especially involving networking, reboot your system.  You may have had a system upgrade and had not yet rebooted.

Do not expect to understand LXC before you’ve thoroughly read this man page. http://lxc.sourceforge.net/man/lxc.html . It’s short.

Get the stuff you need

Instructions:

pacman -Syy lxc bridge-utils

Set up your bridge

Instructions:

Edit /etc/network.d/bridge as

 INTERFACE="br0"
 CONNECTION="bridge"
 DESCRIPTION="Bridge"
 IP='dhcp'

BRIDGE_INTERFACES="eth0"

Now issue these commands

systemctl disable dhcpcd@eth0 # For boot time
systemctl stop dhcpcd@eth0  # For right now
systemctl enable netcfg@br0 # for boot time
systemctl start netcfg@br0 # for right now
systemctl enable dhcpcd@br0 # for boot time
systemctl start dhcpcd@br0 # for right now

For whatever reason this ^ isn’t working on startup for me.  I’ll revisit this.

Install a Debian Container

Get debootstrap

Get Yaourt

Information

You need yaourt to install debootstrap

Instructions

Follow the steps in this section here:
http://archlinux.fr/yaourt-en#get_it

Information

debootstrap lets you install a fresh debian system to a directory

Instructions

yaourt -S debootstrap

Fix the create script

The create script doesn’t work.  Edit /usr/share/lxc/templates/lxc-debian to change

arch=$2

to

arch=’amd64′  # or whatever your architecture may be.

Now make it.

lxc-create -t debian -n mysupercoolcontainer

Wait! Stuff is still broke!

You can’t start your container until you weirdly remount your /, (per these comments https://bugs.archlinux.org/task/31211)

mount / –make-rprivate # Don’t sue me, I haven’t researched what this is, it might break everything.

Now start your container

lxc-start -n mysupercoolcontainer -d # -d makes it run as a daemon instead of forcing a console on your terminal.

Get in there

lxc-console -n mysupercoolcontainer # You’re in, you know what to do.

 

Posted in Uncategorized | Leave a comment

Favorite parts from “A Tour of Go” (in order)


If you happen to see this, bear with me I’m not done yet.

  1. Variable scope defined pre-exec to if-statements are available in else blocks. http://tour.golang.org/#22
  2. If-statements have a pre-exec section just like for-statments. http://tour.golang.org/#21
  3. As common, any portion of the for statement can be omitted (pre, while, post), but with one statement and no semicolon, it behave as a where.  Also for { … } is short-hand for an infinite loop. http://tour.golang.org/#17 http://tour.golang.org/#18 http://tour.golang.org/#19
  4. “Maps” in go are like dicts in python, but with a strictly typed key, but the key can apparently be any type! http://tour.golang.org/#30 (In the tour example, try flipping the string and Vertex types in the map declaration as well as the definition, it works)
  5. You don’t have to dereference a pointer to use its value.  http://tour.golang.org/#26

 

Go back and re-read these wierd things:

Posted in Uncategorized | Leave a comment

Shortcut for Ignoring Tracked Files in Git


Sometimes I make temporary changes to files that I need for the time being but never want to commit, while needing to commit other stuff. I can’t stash the changes because I need them constantly. Thanks to this article and its comments, I put together some aliases to help me out with this little dilemma.


alias git-ignore="git update-index --assume-unchanged "
alias git-ignore-list="git ls-files -v | grep -e '^h' | cut -d' ' -f2"
alias git-unignore="git update-index --no-assume-unchanged "
alias git-unignore-all="git update-index --no-assume-unchanged \`git ls-files -v | grep -e '^h' | cut -d' ' -f2\`"

Posted in Programming, Software | Leave a comment

Different require proof of concept, abusing eval for the sake of clearer definitions




// Sample module libraries (would probably be in their own files)
someModules = { 
	testModule: {test: function(){console.log("test from someModule")}},
	anotherModule: { doStuff: function(){console.log("Doin stuffs!");}}
};

sampleRequire = function() {
	
	// Load the modules
	for (var i=arguments.length-2; i>=0; --i){

		// Create a local variable reference to the module
		eval ('var '+arguments[i]+' = someModules.'+arguments[i].toString());
	}

	// Redefine the programmer's function so that it has my local vars in its scope
	eval("var fn = "+arguments[arguments.length-1]);

	return fn;
}

// Main code...
sampleRequire( 'testModule', 'anotherModule',
 	function(){ 
		testModule.test();
		anotherModule.doStuff();
	}
)();
Posted in Uncategorized | Tagged | Leave a comment

Truthfulness of empty arrays in Javascript… that’s not cool!


An empty array when cast to Boolean evaluates true, indicating that it is truthy.

Boolean([])
true

An empty array compared to true evaluates false, indicating that it is not truthy.

[] == true
false
[] == false
true

And yet the Boolean opposite of an empty array still evaluates false, implying that the empty array is truthy.  What’s an interpreter to do?

![]
false
!![]
true

Just some more contradictory anecdotal evidence to help drive you mad.

Boolean([]) == []
false
Boolean([]) == ![]
false
Boolean([]) == !![]
true
!Boolean([]) == []
true

Conclusion?  I’ll just bit my tongue this time.

Posted in Uncategorized | Leave a comment