View friendly_date_range.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makeFriendlyDates(arr) { | |
dateArr = []; | |
months = { | |
'01':'January','02':'February','03':'March', | |
'04':'April','05':'May','06':'June', | |
'07':'July','08':'August','09':'September', | |
'10':'October','11':'November','12':'December' | |
}; |
View update_inventory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateInventory(curArr, newArr) { | |
// All inventory must be accounted for or you're fired! | |
// using an object so we can assign k'v values | |
var curObj = {}; | |
var returnArr = []; | |
var arr = []; | |
// add to obj so we can access k,v's | |
curArr.forEach(function(data){ |
View cowsandbulls.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint, randrange | |
number = [randrange(1,9) for x in range(4)] | |
guesscount = 1 | |
def game(guess): | |
cows = 0 | |
bulls = 0 | |
global guesscount | |
if guess != ''.join(str(x) for x in number): |
View randompassword.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
def main(passlen = 8): | |
password = [] | |
for x in range(0,passlen): | |
r = randint(1, 4) | |
if r == 1: | |
password.append(chr(randint(97,122))) | |
elif r == 2: | |
password.append(str(randint(0,9))) |
View gist:0073b8d14dc8d8a3668e716bed44cf9f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Download/tar xvfz oracle java (somewhere like /opt/java is fine) | |
# update-alternatives --install /usr/bin/java java /path/to/oracle/install/java 1000 | |
# update-alternatives --install /usr/bin/javac javac /path/to/oracle/install/javac 1000 | |
# update-alternatives --config java | |
# update-alternatives --config javac | |
View gist:fc847b0d60d382040696
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
#!/usr/bin/python | |
import urllib2 | |
import json | |
import time | |
import os | |
import sys | |
import pprint | |
class weatherData: |
View alarmclock.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
''' | |
jamesbos [at] gmail [dot] com - originally shared at https://gist.github.com/jampola/ad3995e227dc46cfe069 | |
Fully functioning alarm clock. Very primitive I know but this shows how basic events and | |
"threading" within pygtk[1] and media playback in gst[2] works. The main reason for sharing this on gist.github.org is so | |
it is searchable via google. | |
Include a an mp3 file called "alarm.mp3" in the same directory as this file OR supply the | |
/path/to/whatever.mp3/wav/ogg that you wish to play. |
View clock.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from gi.repository import Gtk, GObject | |
from datetime import datetime | |
class MainWindow(Gtk.Window): | |
def __init__(self): | |
Gtk.Window.__init__(self, title="app") | |
self.box = Gtk.Box(spacing=6) | |
self.add(self.box) |