Skip to content

Instantly share code, notes, and snippets.

@atomd-zz
atomd-zz / gist:18f19f4bc98c95a38d46
Created January 14, 2016 17:51 — forked from munhitsu/gist:1034876
python 2.7.5 install on OSX (10.8+) using brew (pip, easy_install, virtualenv, virtualenvwrapper)
# 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
@atomd-zz
atomd-zz / AbstractCameraFragment
Created December 25, 2015 07:54 — forked from mjurkus/AbstractCameraFragment
Abstract camera fragment implementation using focus modes
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;
# 本文件存放在project目录下。
RELEASE_STORE_FILE={path to your keystore}
RELEASE_STORE_PASSWORD=*****
RELEASE_KEY_ALIAS=*****
RELEASE_KEY_PASSWORD=*****

环境 (Environment)

版本:Ubuntu 14.04 LTS 默认语言:English(United States)

安装 (Setup)

Debian 和 Ubuntu 下对中文支持比较好的字体有: fonts-droid、ttf-wqy-zenhei 和 ttf-wqy-microhei 等,除了文泉驿系列字体外,比较流行的免费中文字体还有文鼎提供的楷体和上海宋,包名分别是: fonts-arphic-ukai 和 fonts-arphic-uming。

######################################################################
# CURRENT AWARE LOCAL DATETIME
######################################################################
from datetime import datetime
from tzlocal import get_localzone
local_tz = get_localzone()
local_dt = datetime.now(local_tz)
@atomd-zz
atomd-zz / client.py
Created February 3, 2013 12:01
wsgi file upload
# -*- 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)
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])
@atomd-zz
atomd-zz / about.md
Created October 30, 2012 13:58 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@atomd-zz
atomd-zz / the2sin18_queue.hpp
Created September 18, 2012 14:39
Lock-based & Lock-free RingBuffers
#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
@atomd-zz
atomd-zz / master_ip_failover
Created April 5, 2012 12:14
MHA master_ip_failover script
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
);