Skip to content

Instantly share code, notes, and snippets.

@poundifdef
poundifdef / donut.c
Created July 10, 2011 05:59
`indent` output of http://a1k0n.net/2006/09/15/obfuscated-c-donut.html and the 2nd iteration, donut2.c
k;
double sin (), cos ();
main ()
{
float A = 0, B = 0, i, j, z[1760];
char b[1760];
printf ("\x1b[2J");
for (;;)
{
memset (b, 32, 1760);
@poundifdef
poundifdef / IR_Rcvr.c
Created September 3, 2011 14:37 — forked from PhirePhly/IR_Rcvr.c
MSP430 IR Serial Demo
// Simple IR Receiver
// Kenneth Finnegan, 2011
// kennethfinnegan.blogspot.com
//
// Pinout:
// P1.[0..7] - Common anode 7 segment display w/ decimal
// P2.5 - 38kHz IR receiver
#include <msp430g2252.h>
@poundifdef
poundifdef / gist:2191046
Created March 25, 2012 03:16
linux mint 12 /etc/apt/sources.lst
deb http://packages.linuxmint.com/ lisa main upstream import
deb http://archive.ubuntu.com/ubuntu/ oneiric main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ oneiric-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ oneiric-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ oneiric partner
deb http://packages.medibuntu.org/ oneiric free non-free
deb-src http://packages.linuxmint.com/ lisa main upstream import
deb-src http://archive.ubuntu.com/ubuntu/ oneiric main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ oneiric-updates main restricted universe multiverse
def ftrain(l):
"""https://twitter.com/ftrain/status/267503513477713920
Assumes list will be "deepest" in the center
"""
# are all elements the same? group together and return
if len(set(l)) <= 1:
return l
class Parent(object):
def __init__(self, username, password):
self.username = username
self.password = password
def _get_name(self):
return self.username.upper()
def child_action(self):
import requests
from dict2xml import dict2xml
import xmltodict
from datetime import datetime
class UPSConnection(object):
test_urls = {
<?xml version="1.0" ?>
<AccessRequest xml:lang='en-US'>
<AccessLicenseNumber>YOURACCESSLICENSENUMBER</AccessLicenseNumber>
<UserId>YOURUSERID</UserId>
<Password>YOURPASSWORD</Password>
</AccessRequest>
<?xml version="1.0" ?>
<TrackRequest>
<Request>
<?xml version="1.0" ?>
<TrackResponse>
<!-- ...snip... -->
<ShipTo>
<Address>
<City>Timonium</City>
<StateProvinceCode>MD</StateProvinceCode>
<CountryCode>US</CountryCode>
@poundifdef
poundifdef / gist:5809780
Created June 18, 2013 21:49
30-seconds to request URL
jay@gillespie:~/github/beagle$ curl -vvv http://www.stevenalanoptical.com/collection/mens-eyewear/ > /dev/null
* About to connect() to www.stevenalanoptical.com port 80 (#0)
* Trying 184.72.157.199... % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0connected
> GET /collection/mens-eyewear/ HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: www.stevenalanoptical.com
> Accept: */*
>
@poundifdef
poundifdef / gist:5810824
Created June 19, 2013 00:41
9s delay :/
jay@gillespie:~$ curl -vvv -I -H 'X-Debug: true' http://www.stevenalanoptical.com/collection/mens-eyewear/
* About to connect() to www.stevenalanoptical.com port 80 (#0)
* Trying 54.242.182.43... connected
> HEAD /collection/mens-eyewear/ HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: www.stevenalanoptical.com
> Accept: */*
> X-Debug: true
>
< HTTP/1.1 200 OK