Skip to content

Instantly share code, notes, and snippets.

View pyro2927's full-sized avatar
๐Ÿ’ญ
I may be slow to respond.

Joseph Pintozzi pyro2927

๐Ÿ’ญ
I may be slow to respond.
View GitHub Profile
@pyro2927
pyro2927 / gtranslate.rb
Created November 13, 2013 17:43
Copy down Google Translations into COUNTRYCODE.lproj/Localizable.strings
require "google_drive"
session = GoogleDrive.login("EMAIL_ADDRESS", "PASSWORD")
# Document key is the value found for the key param in the url
# ex: https://docs.google.com/spreadsheet/ccc?key=0Atoge9gLkMCTdHdza2FxTDliakNGamRXV01WYmNUUVE&usp=drive_web
# has a key of 0Atoge9gLkMCTdHdza2FxTDliakNGamRXV01WYmNUUVE
ws = session.spreadsheet_by_key("DOCUMENT_KEY").worksheets[0]
word_indexes = (3..8) # the rows in which your translated words exist
@pyro2927
pyro2927 / wheel_of_fortune.coffee
Last active December 31, 2015 13:19
Wheel of Fortune spinner for Hubot
# Description:
# Made so we can play Wheel of Fortune in Campfire
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
@pyro2927
pyro2927 / plex-proxy.pac
Created March 4, 2014 13:45
PAC file to automatically configure your proxy
function FindProxyForURL(url, host) {
PROXY = "PROXY 127.0.0.1:8080; DIRECT"
// plex.tv via proxy
if (shExpMatch(host,"*.plex.tv")) {
return PROXY;
}
// Everything else directly!
return "DIRECT";
}
var listModelGraph = attrs.listModel.split('.');
$scope.valueArray = _.reduce(listModelGraph, function (scope, node) { return scope[node]; }, $scope);
@pyro2927
pyro2927 / Vagrantfile
Created July 31, 2014 15:13
rails_vagrant_file
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "eduardodeoh/precise64-rails-dev"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
@pyro2927
pyro2927 / Spot.groovy
Last active August 29, 2015 14:04
SmartThings Spot Controller
/**
* Spot
*
* SmartThings device type attempting to integrate with https://github.com/minton/Spot
*
* Copyright 2014 Joseph Pintozzi
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
@pyro2927
pyro2927 / ubuntu_istatd.sh
Last active August 29, 2015 14:06
Ubuntu server istatd install
# install istatd on a fresh Ubuntu server
# expects to be run as root
# run automatically with `curl -sSL https://gist.githubusercontent.com/pyro2927/b18268834dccabf6b6d9/raw/9070d28d0cfb842b1cae33097cc9b47ce141059e/ubuntu_istatd.sh | bash`
apt-get install -y build-essential autoconf automake checkinstall libxml2-dev
wget https://github.com/tiwilliam/istatd/archive/r0.5.8.tar.gz
tar xvzf r0.5.8.tar.gz
cd istatd-r0.5.8/
autoreconf -i
./configure
make
@pyro2927
pyro2927 / esxi_to_istat.py
Last active August 29, 2015 14:06
Middle-layer to present ESXi vCenter monitoring stats in Bjango's iStat2
## converting ESXi stats to iStat stats
## passed via XML on a TCP connection over port 5109
## example XML at:
## https://github.com/threez/istat/blob/master/spec/frames/measurement_request_spec.rb#L14
## Main things to go after:
#
# CPU usage, id, user, system, nice
# LOAD
# MEMORY usage, wired, active, inactive, free, total, swap used, swap_total, page_ins, page_outs
@pyro2927
pyro2927 / DismissiveEditText.java
Created October 9, 2014 19:58
I just want 'enter' to dismiss the keyboard :(
public class DismissiveEditText extends EditText implements View.OnKeyListener, TextView.OnEditorActionListener {
public DismissiveEditText(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public DismissiveEditText(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
import string
def scaryDict(filename):
inFile = open(filename)
outFile = open('dictonary.txt', 'w') #find universal solution
content = inFile.read()
content = ''.join([c for c in content.lower() if c in (string.letters + string.whitespace) ])
words = sorted(set(content.split()))
for word in words:
if len(word) <= 2:
words.remove(word)