Skip to content

Instantly share code, notes, and snippets.

View chrisyco's full-sized avatar

Chris Wong chrisyco

View GitHub Profile
@chrisyco
chrisyco / power.sh
Created May 24, 2011 03:38
Suspend, hibernate, restart or shutdown the computer without sudo!
#!/bin/sh
# Suspend, hibernate, restart or shutdown the computer without sudo!
# by Chris Wong
# Released to the public domain.
NAME=$0
usage() {
echo "Usage: $NAME suspend|hibernate|restart|shutdown"
@chrisyco
chrisyco / fixext.py
Created May 23, 2011 04:05
Recursively rename UPPERCASE filename extensions to lowercase
#!/usr/bin/env python
"""Epic script to rename scary uppercase extensions (like .JPG) to
more friendly lowercase (like .jpg).
How to use
==========
Recursively rename all files in the current directory::
fixext
@chrisyco
chrisyco / gist:972805
Created May 15, 2011 01:23
Epic Example From Java Specification
interface Fish { int getNumberOfScales(); }
interface Piano { int getNumberOfScales(); }
class Tuna implements Fish, Piano {
// You can tune a piano, but can you tuna fish?
int getNumberOfScales() { return 91; }
}