This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
use strict; | |
use warnings FATAL => 'all'; | |
use Getopt::Long; | |
my ( | |
$command, $ssh_user, $orig_master_host, $orig_master_ip, | |
$orig_master_port, $new_master_host, $new_master_ip, $new_master_port | |
); |
#ifndef THE2SIN18_QUEUE_H | |
#define THE2SIN18_QUEUE_H | |
#ifndef CACHELINE_SIZE | |
#define CACHELINE_SIZE 64 | |
#endif | |
#ifndef NON_ALIGNED | |
#define ALIGNED __attribute__((aligned(CACHELINE_SIZE))) | |
#endif |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
import socket | |
import fcntl | |
import struct | |
def get_ip_address(ifname): | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
return socket.inet_ntoa(fcntl.ioctl( | |
s.fileno(), | |
0x8915, # SIOCGIFADDR | |
struct.pack('256s', ifname[:15]) | |
)[20:24]) |
# -*- coding: utf-8 -*- | |
import httplib | |
import sys | |
import mimetypes | |
import os | |
CHUNKSIZE = 65563 | |
url="http://127.0.0.1:8090/" | |
conn = httplib.HTTPConnection("127.0.0.1", 8090) |
###################################################################### | |
# CURRENT AWARE LOCAL DATETIME | |
###################################################################### | |
from datetime import datetime | |
from tzlocal import get_localzone | |
local_tz = get_localzone() | |
local_dt = datetime.now(local_tz) |
# 本文件存放在project目录下。 | |
RELEASE_STORE_FILE={path to your keystore} | |
RELEASE_STORE_PASSWORD=***** | |
RELEASE_KEY_ALIAS=***** | |
RELEASE_KEY_PASSWORD=***** |
public abstract class AbstractCameraFragment extends MDFragment implements UnexpectedTerminationHelper.OnCrashListener, SurfaceHolder.Callback, Camera.AutoFocusCallback { | |
protected Camera camera; | |
private boolean previewRunning, cameraReleased, focusAreaSupported, meteringAreaSupported; | |
private UnexpectedTerminationHelper terminationHelper; | |
private int focusAreaSize; | |
private FocusSound focusSound; | |
private Matrix matrix; | |
protected ResultListener resultListener; |
# In case you had some strange python installation | |
# NOTE: .pydistutils.cfg seems to be not compatible with brew install python | |
# areas I needed to clean before installation | |
# clean up ~/Library/Python | |
# clean up .local | |
# preconditions: | |
# xcode with command line tools installed | |
xcode-select --install |