Skip to content

Instantly share code, notes, and snippets.

View lg's full-sized avatar

Larry Gadea lg

View GitHub Profile

Keybase proof

I hereby claim:

  • I am lg on github.
  • I am lg (https://keybase.io/lg) on keybase.
  • I have a public key whose fingerprint is AE87 C7DA DCB5 9259 79DA 640B 4B77 1DF8 8CFD A749

To claim this, I am signing this object:

@lg
lg / twilio_ld.php
Created January 5, 2015 03:36
TwiML for a long distance phone dialer
<?php
$my_url = 'http://MYDOMAIN.COM/twilio_ld/twilio_ld.php';
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response>';
if (array_key_exists('passcode_check', $_GET)) {
if ($_POST["Digits"] == '1') {
echo '<Gather timeout="5" finishOnKey="*" action="' . $my_url . '?dial">';
@lg
lg / cors_http_server.py
Created July 19, 2015 20:04
Creates a CORS HTTP Server
#! /usr/bin/env python2
from SimpleHTTPServer import SimpleHTTPRequestHandler
import BaseHTTPServer
class CORSRequestHandler (SimpleHTTPRequestHandler):
def end_headers (self):
self.send_header('Access-Control-Allow-Origin', '*')
SimpleHTTPRequestHandler.end_headers(self)
if __name__ == '__main__':
@lg
lg / Ruby array operations in CoffeeScript
Created December 25, 2010 00:34
To try to pick up on CoffeeScript, i wrote a few quick functions to mimic Ruby's Array operations
Array::collect = (action) ->
for item in this
action(item)
Array::map = (action) -> this.collect(action)
Array::inject = (initial, action) ->
for item in this
initial = action(initial, item)
initial
@lg
lg / dlchromium.sh
Created August 7, 2011 01:39
Download Latest Nightly Chromium For Mac
if [ $(ps aux | grep "Chromium.app" | grep -v grep | wc -l) -gt 0 ]; then
echo "Please close all Chromium instances before running this script"
exit 1
fi
if [ $(whoami) != "root" ]; then
echo "Please run this script with sudo to allow for installation into /Applications"
exit 1
fi
@lg
lg / dailyboothdl.sh
Created August 30, 2011 00:09
Download all booths from a dailybooth user
# replace USERNAMEHERE with the username of the user whose booths you'd like to copy (there are 4 instances you need to find/replace
echo "" > out.csv
CUR_PAGE=1
while true; do
curl --silent "http://dailybooth.com/USERNAMEHERE/quilt/page/$CUR_PAGE" > page.html
if ! grep "div><a href=\"/USERNAMEHERE/" page.html > /dev/null; then
echo "Done"
break
@lg
lg / clubtrance.sh
Created September 12, 2011 06:41
get download links for 0day trance music from clubtrance
# this will print out links to all 0day trance songs listed on club-trance.net.
# no downloads are done, we're just scraping. output is to be copied and pasted into jdownloader.
# oh also sites listed in the output are logged to a 'visited' file to prevent duplication
# send your cease and desist to trivex@gmail.com. thanks!
touch visited
echo "Downloading index"
for showthread_link in `curl --silent "http://club-trance.net/forumdisplay.php?fid=92" | perl -0777 -ne 'print "$1\n" while /href="(showthread\.php\?tid=\d+?)" class=" subject_new"/gs'`; do
echo "Checking $showthread_link"
@lg
lg / findmintedppl.sh
Created September 18, 2011 05:30
Find random people on minted.com
# change YOURFRIENDSNAMEHERE to your friend's name
for i in {2000..2230}; do echo $i; if curl --silent "http://www.minted.com/search?designerID=$i" | grep -i 'YOURFRIENDSNAMEHERE'; then echo "match $i"; fi; done
@lg
lg / gist:1851003
Created February 17, 2012 05:44
Monitor Converse's website for available shoe sizes on a given sku and send an email when changed
curl --silent 'http://www.converse.com/handler/Products/ProductDetailHandler.ashx?sku=129331C' | xpath '/ProductDetailHandler/Product/ShoeSizes/ShoeSize/Size[@type="US Mens"]/text()' 2>&1 | sed 's/-- NODE --//'| sed 's/Found.*//' | egrep '.' > /tmp/lastsizesLATEST ; if ! diff /tmp/lastsizesLATEST /tmp/lastsizes > /dev/null; then $( cat /tmp/lastsizesLATEST | mail -s 'shoe sizes changed' 'youremail@gmail.com' ); else echo 'not changed'; fi; rm -f /tmp/lastsizes; cp /tmp/lastsizesLATEST /tmp/lastsizes
@lg
lg / precompile_assets.rb
Created March 8, 2013 23:21
Force files to be precompiled by the Rails 3 asset pipeline via instructions in _precompile.js and _precompile.css. Add this to config/environments/production.rb
get_requires_from_file = Proc.new do |filename|
files = Sprockets::DirectiveProcessor.new(filename).directives.collect { |f| f[1] == "require" ? f[2] : nil }.compact
files.collect do |file|
search_path = File.join(File.dirname(filename), file)
files = Dir.glob("#{search_path}.*")
files.collect { |f| File.basename(f) }
end.flatten
end
config.assets.precompile +=
get_requires_from_file.call("app/assets/javascripts/_precompile.js") +