This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:void(window.location=window.location.toString().replace(/%5Ehttps:%5C/%5C/(?:www%5C.)?github%5C.com%5C/(%5Cw+)(?:%5C/.*)?$/,'https://gists.github.com/$1')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pbpaste | pbcopy | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python3 -m http.server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
""" | |
store and check items in a bloom filter | |
limitations: | |
- not optimized for speed. | |
- data structures on disk are not protected from multiple writers... so, use accordingly. | |
- some other rough edges... under development. example: no quiet option. | |
- mixing conventional bloom filter and vector treatment complicates things somewhat. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $path = $ENV{'XcodeProjectPath'}; | |
$path =~ s{(.*)/\w+\.xcodeproj}{"$1"}; | |
my $cmd = "/usr/bin/find $path -type f -name \"*.[mh]\" -print"; | |
my $files = qx($cmd); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Add tags to a set of comment lines in notes.txt | |
This opens a file called notes.txt in the current | |
working directory (creating the file if it does not | |
exist) and prepends lines to it containing the tags | |
that are passed in on the command line. Tags are | |
only added once. Can be run again any time to add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* from Bill Dudney's Practical Drawing session at 2011 WWDC */ | |
+ (UIImage *)scaleImage:(UIImage *)image toSize:(CGSize)newSize { | |
UIGraphicsBeginImageContextWithOptions(newSize, YES, 0.0); | |
CGRect imageRect = {{0.0, 0.0}, newSize}; | |
[image drawInRect:imageRect]; | |
UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return scaledImage; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export index=~/work/indexes | |
mkdir -p $index | |
cd ~/work | |
for dir in `ls -d *` | |
do | |
if [[ -d "$dir" ]]; then | |
echo doing $dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defaults write com.apple.screencapture location ~/path/ | |
killall SystemUIServer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# modified from the broken 'perldoc perlfunc' getsockopt example by adding one line (see comment below) | |
use strict; | |
use warnings; | |
use Socket qw(:all); | |
defined(my $tcp = getprotobyname("tcp")) |