This file contains hidden or 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
<?php | |
$startDate = new DateTime('2014-11-12 12:00:00'); | |
$endDate = clone $startDate; | |
$endDate->add(new DateInterval('P5D')); | |
$days = iterator_to_array(new DatePeriod($startDate, new DateInterval('P1D'), $endDate)); |
This file contains hidden or 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/sh | |
set -u | |
echo "Branch name:" | |
read BRANCH_NAME | |
git checkout -b "$BRANCH_NAME" | |
git commit --allow-empty -m "create wip" |
This file contains hidden or 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/sh | |
bfg --delete-files $@ $(git rev-parse --show-toplevel) |
This file contains hidden or 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/sh | |
hide_desktop() { | |
echo "change configuration to hide desktop icons." | |
defaults write com.apple.finder CreateDesktop -boolean false | |
} | |
show_desktop() { | |
echo "change configuration to display desktop icons." | |
defaults delete com.apple.finder CreateDesktop |
This file contains hidden or 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/sh | |
git log --stat --after `date +'%F' --date '1 day ago'` |
This file contains hidden or 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
#import <UIKit/UIKit.h> | |
@interface UIImage (R4) | |
+ (UIImage *)imageNamedR4:(NSString *)name; | |
@end |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"os" | |
"log" | |
"strconv" | |
"strings" | |
"time" | |
) |
This file contains hidden or 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
>> sysctl -w net.inet.ip.scopedroute=0 | |
sysctl: oid 'net.inet.ip.scopedroute' is read only | |
Updating kernel boot flags. | |
>> defaults read /Library/Preferences/SystemConfiguration/com.apple.Boot Kernel Flags | |
>> defaults write /Library/Preferences/SystemConfiguration/com.apple.Boot Kernel Flags net.inet.ip.scopedroute=0 | |
s: Ready: 1 r=[4] w=[] x=[] | |
s: < channel=0 cmd=PING len=7 | |
s: > channel=0 cmd=PONG len=7 (fullness=53) | |
s: mux wrote: 15/15 | |
s: Waiting: 1 r=[4] w=[] x=[] (fullness=60/0) |
This file contains hidden or 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
import pkg_resources | |
try: | |
import xmlrpc.client as xmlrpclib | |
except ImportError: | |
import xmlrpclib | |
import pip | |
import pip.download | |
from pip.log import logger | |
from pip.basecommand import Command | |
from pip.util import get_installed_distributions |
This file contains hidden or 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
/* fetch local IP address */ | |
err = net_default_source_addr_get(AF_INET, &laddr); | |
if (err) { | |
re_fprintf(stderr, "local address error: %s\n", strerror(err)); | |
goto out; | |
} | |
inet_aton("127.0.0.1", &(laddr.u.in.sin_addr)); |