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
import sys
count = 0
board = [x[:] for x in [[0]*8]*8]
def drawBoard():
for i in range(0, len(board)):
if(i>0):
sys.stdout.write(" | "+str(i-1))
from Tkinter import *
import time, thread
master = Tk()
master.title("Switch test")
w = Canvas(master, width=200, height=200)
w.pack()
w.create_rectangle(0, 0, 200, 100, fill="white")
import sys
if len(sys.argv) <= 1:
sys.argv.append("/usr/share/dict/words")
f = open(sys.argv[1], "r")
order = "qazwsxedcrfvtgbyhnujmikolp"
for line in f:
import sys
matrix = [[0 for i in range(9)] for j in range(9)]
#m = [list("003020600"),list("900305001"),list("001806400"),list("008102900"),list("700000008"),list("006708200"),list("002609500"),list("800203009"),list("005010300")]
#
#for x in range(0, len(matrix)):
# for y in range(0,len(matrix[0])):
# matrix[x][y] = int(m[x][y])
@vgmoose
vgmoose / gist:5719336
Created June 6, 2013 04:31
convert.py
output = ""
for x in range(0, 9):
line = raw_input()
for y in range(0, 9):
if (line[y] != 0):
output += str(x) + " " + str(y) + " " + line[y]
output += "\n"
output += "0 0 0\n"
require 'net/http'
require 'net/https'
@toSend = '{"currency":"USD","models":[{"toolID":"","modelReference":"model.xml","materialID":"12a65a42-df49-47a9-8828-0efaf84c5509","finishID":"c9c27ce3-eee4-47e4-a896-a9010a7971fd","quantity":1,"xDimMm":24.053077028234622,"yDimMm":24.671680341529406,"zDimMm":9.59760028403155,"volumeCm3":0.27144738160643134,"surfaceCm2":7.8405772975064245}],"shipmentInfo":{"countryCode":"US","stateCode":"NH","city":"Nashua","zipCode":"03063"}}'
uri = URI.parse("https://i.materialise.com/web-api/pricing")
https = Net::HTTP.new(uri.host,uri.port)
https.use_ssl = true
req = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json', 'Accept' => 'json', 'APICode' => '0FE2EF5F-95E3-4552-B637-55B824E3EF35'})
req.body = "#{@toSend}"
@vgmoose
vgmoose / gist:6478345
Created September 7, 2013 19:08
accepts <foo<bar> input as valid html and doesn't throw malformed start tag
def check_for_whole_start_tag(self, i):
rawdata = self.rawdata
locatestarttagend = re.compile(r"""
<[a-zA-Z][-.a-zA-Z0-9:_]* # tag name
(?:\s+ # whitespace before attribute name
(?:[a-zA-Z_][-.:a-zA-Z0-9_]* # attribute name
(?:\s*=\s* # value indicator
(?:'[^']*' # LITA-enclosed value
|\"[^\"]*\" # LIT-enclosed value
|[^'\">\s]+ # bare value
@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 / auth.sh
Last active September 11, 2016 15:48
spire thing
USER='USERNAME' # edit this
PASS='PASSWORD' # edit this
rm cookies.txt
COOKIES='cookies.txt'
USER_AGENT='Firefox/3.5'
curl --silent -X GET 'https://spire.umass.edu' --user-agent $USER_AGENT --cookie $COOKIES --cookie-jar $COOKIES --location >/dev/null
curl --silent -X POST 'https://www.spire.umass.edu/psp/heproda/' --user-agent $USER_AGENT --data-urlencode "userid=${USER}" --data-urlencode "pwd=${PASS}" --data-urlencode "languageCd=ENG" --data-urlencode "timezoneOffset=0" --data-urlencode "Submit=Go" --data-urlencode "cmd=login" --cookie $COOKIES --cookie-jar $COOKIES >/dev/null
@vgmoose
vgmoose / colorstrip.user.js
Created March 29, 2014 00:22
removes twitch color
// ==UserScript==
// @name Twitch Color Strip
// @namespace http://www.twitch.tv/
// @version 0.1
// @description Removes all colors from the chat in twitch
// @match http://www.twitch.tv/*
// @copyright vgmoose
// @icon http://vgmoose.com/5ff376.png
// ==/UserScript==