Skip to content

Instantly share code, notes, and snippets.

View vgmoose's full-sized avatar
🌱
making my way downtown, walking fast

vgmoose vgmoose

🌱
making my way downtown, walking fast
View GitHub Profile
@vgmoose
vgmoose / gist:8449580
Created January 16, 2014 04:00
shorten a given URL using goog.gl
function getShortURL(url)
{
return jQuery.ajax({
'type': 'POST',
'url': "https://www.googleapis.com/urlshortener/v1/url",
'contentType': 'application/json',
'data': JSON.stringify({"longUrl" : url}),
'success': function(data){console.log(data.id)}
});
}
@vgmoose
vgmoose / itunes.py
Created January 16, 2016 20:43
displays the top 10 play counts in itunes
# usage: python itunes.py /Users/$USER/Music/iTunes/iTunes\ Music\ Library.xml
import plistlib
import sys
if len(sys.argv) > 1:
data = plistlib.readPlist(sys.argv[1])
tracks = data["Tracks"]
@vgmoose
vgmoose / a.c
Last active February 3, 2016 19:32
rotation problems
#include <math.h>
#include <stdio.h>
double my_atan(double x)
{
//printf("%f\n", x);
return x - (x*x*x)/3 + (x*x*x*x*x)/5 - (x*x*x*x*x*x*x)/7 + (x*x*x*x*x*x*x*x*x)/9;
}
@vgmoose
vgmoose / Java_BS.java
Last active February 25, 2016 03:57
Bubble sort in multiple languages
import java.util.Arrays;
public class Java_BS
{
public static void main(String[] args)
{
// Declare Array
int[] A = {6,5,3,1,8,7,2,4};
// Set length
# imports
import random
# explain the game
print("Let's play a number guessing game.")
print("Think of a number between 1 and 1000, and I will try to guess it.")
# optimal first guess is 500 for 1 through 1000
low_guess = 1
high_guess = 1000
@vgmoose
vgmoose / mario.py
Created January 11, 2016 02:30
Get information about a Super Mario Maker level given its course ID
import urllib
import sys
from lxml.html import fromstring
def usage():
print("Usage: python mario.py [course id]")
print(" ex: python mario.py 3410-0000-0183-C4A2")
if len(sys.argv) < 2:
usage()
ins = [ [ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 ], [ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 ], [ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 ], [ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 ], [ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 2, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 ], [ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 12, 13, 12, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 ], [ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 2, 5, 12, 5, 2, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
class Whatever:
value = 0
othervalue = 5
def meth(self):
return 3
def dothings(self, inp):
self.value = inp;
return self.othervalue
c = Whatever()
@vgmoose
vgmoose / mrange.py
Created April 26, 2016 13:54
A memory effective in-range-checker
class mrange:
def __init__(self, low, high):
self.low = low
self.high = high
def __contains__(self, value):
return value >= self.low and value <= self.high
a = mrange(3, 3924820948239749237439287423)
print 324729847 in a
print 2 in a
<?php
require_once("wiiu_browserhax_common.php");
if($sysver==532)
{
$first_tx3g_size = 0x7800;
}
else if($sysver==550 || $sysver==540)
{