Skip to content

Instantly share code, notes, and snippets.

View scottfrazer's full-sized avatar
👋

Scott Frazer scottfrazer

👋
View GitHub Profile
import os
from datetime import date
for file in os.listdir('.'):
print( file, date.fromtimestamp( os.stat(file).st_mtime ))
from datetime import date
string = 'vpx_1021094819038401_051911'.split('_')[-1]
print(date(int(str[4:]), int(str[:2]), int(str[2:4])))
from datetime import date
string = 'vpx_1021094819038401_051911'
parts = string.split('_')
dateportion = parts[-1]
year = int(str[4:])
month = int(str[:2])
day = int(str[2:4])
@scottfrazer
scottfrazer / swap.c
Created June 6, 2011 15:04
swap with xor
void swap (int * y, int * y)
{
if (*x != *y)
{
*x ^= *y;
*y ^= *x;
*x ^= *y;
}
}
#include <stdio.h>
void swap_bytes( char * x, char * y )
{
if ( *x != *y )
{
*x ^= *y;
*y ^= *x;
*x ^= *y;
}
static int is_prime( unsigned int x )
{
if ( x == 1 ) return false;
else if ( x < 4 ) return true;
else if ( x % 2 == 0 ) return false;
else if ( x < 9 ) return true;
else if ( x % 3 == 0 ) return false;
else
{
double r;
for a in [1, 2, 'hello', 2**10]:
print(a)
@scottfrazer
scottfrazer / gist:1045260
Created June 24, 2011 17:34
python test
%%$@_$^__#)^)&!_+]!*@&^}@[@%]()%+$&[(_@%+%$*^@$^!+]!&_#)_*}{}}!}_]$[%}@[{_@#_^{*
@##&{#&{&)*%(]{{([*}@[@&]+!!*{)!}{%+{))])[!^})+)$]#{*+^((@^@}$[**$&^{$!@#$%)!@(&
+^!{%_$&@^!}$_${)$_#)!({@!)(^}!*^&!$%_&&}&_#&@{)]{+)%*{&*%*&@%$+]!*__(#!*){%&@++
!_)^$&&%#+)}!@!)&^}**#!_$([$!$}#*^}$+&#[{*{}{((#$]{[$[$$()_#}!@}^@_&%^*!){*^^_$^
]@}#%[%!^[^_})+@&}{@*!(@$%$^)}[_!}(*}#}#___}!](@_{{(*#%!%%+*)^+#%}$+_]#}%!**#!^_
)@)$%%^{_%!@(&{!}$_$[)*!^&{}*#{!)@})!*{^&[&$#@)*@#@_@^_#*!@_#})+[^&!@*}^){%%{&#@
@{%(&{+(#^{@{)%_$[+}]$]^{^#(*}%)@$@}(#{_&]#%#]{_*({(])$%[!}#@@&_)([*]}$}&${^}@(%
(%[@%!}%*$}(*@)}){+@(%@*$&]*^*}*]&$[}*]%]+*}^!}*$^^_()#$^]++@__){&&+((#%+(&+){)$
%&&#($[[+##*%${)_!+{_[})%++)$#))]]]$]@]@($+{&%&%+!!!@]_]+])^*@$(@#${}}#}{%}#+{(@
#__+{{]${]!{(%${%%^)(_*_@+)$]$#_@$)]](}{}$(}*%+!}#+)$%$}+#@*&^{##}+@(%[*@_}{(^]^
7aaf7151:1 4f545e21:1
Images size (bytes) 281004 279974
Image files 34 34
Time to Load (ms) 8508 6202
JS files 21 21
Time to First Byte (ms) 2915 1020
JS size (bytes) 256938 296064
TTL - TTFB (ms) 5593 5182
CSS files 4 4
CSS size (bytes) 14388 14387
<?php
require_once 'modules/constituent/data/cons_group.data.php';
class Constituent_Scott_Controller extends Blue_Controller_Base
{
public function processRequest(Blue_Controller_Request $request, Blue_Controller_Response $response)
{
$group = new cons_group();
$response->setHeader('Content-Type', 'text/plain');