Skip to content

Instantly share code, notes, and snippets.

View errord's full-sized avatar
🎯
Focusing

error.d errord

🎯
Focusing
View GitHub Profile
@errord
errord / install-pypy.sh
Created April 25, 2012 06:38 — forked from baoshan/install-pypy.sh
Install PyPy on CentOS
# yum list \*openssl\*
yum install -y openssl098e
yum install -y zlib
ln -s /usr/lib64/libssl.so.0.9.8e /usr/lib64/libssl.so.0.9.8
ln -s /usr/lib64/libcrypto.so.0.9.8e /usr/lib64/libcrypto.so.0.9.8
ln -s /lib64/libbz2.so.1 /lib64/libbz2.so.1.0
wget https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux64.tar.bz2
tar -xf pypy-1.8-linux64.tar.bz2
cp -r pypy-1.8 /opt
ln -s /opt/pypy-1.8/bin/pypy /usr/local/bin
@errord
errord / rabbitmq-install-osx.md
Created May 25, 2012 04:57 — forked from chrisabrams/rabbitmq-install-osx.md
Troubleshooting RabbitMQ installation on OSX via homebrew

Troubleshooting RabbitMQ installation on OSX via homebrew

brew update
brew install rabbitmq

To see if rabbitmq is running after following the installation instructions:

launchctl list | grep rabbit
> 48303	-	homebrew.mxcl.rabbitmq
@errord
errord / getline.c
Last active December 29, 2015 23:49
/* PASTE AT TOP OF FILE */
#include <stdio.h> /* flockfile, getc_unlocked, funlockfile */
#include <stdlib.h> /* malloc, realloc */
#include <errno.h> /* errno */
#include <unistd.h> /* ssize_t */
extern "C" ssize_t getline(char **lineptr, size_t *n, FILE *stream);
/* PASTE REMAINDER AT BOTTOM OF FILE */
@errord
errord / gist:7763001
Created December 3, 2013 02:37
指定spark master ip启动spark
SPARK_MASTER_IP=192.168.0.xx ./start-all.sh
@errord
errord / gist:7801466
Created December 5, 2013 07:25
android面试
一. Android问题
为适应多机型适配作出的努力。
使用dip代替px。
通过创建values-hdpi, values-mdpi, values-xhdpi分别为不同的屏幕大小的机型定制不同的布局。
设置字体大小的时候通过TextAppearnce="@android:style/TextAppearance.[Large, Small, Medium]"来设置大小。
设想我们要做一个app,这个app中间有一个登陆的逻辑。在用户完成登陆后需要改变其他activity的一些界面,这怎么做比较好?
如果他的描述中有"BroadcastReceive"就是正确答案.
有没有写过custom view.
@errord
errord / gist:7926810
Created December 12, 2013 11:45
python crypto AES
# -*- coding: utf-8 -*-
from Crypto.Cipher import AES
import os
BS = AES.block_size
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
key = os.urandom(16) # the length can be (16, 24, 32)
text = 'to be encrypted'
@errord
errord / gist:623ebb7e60a213881aa7
Created May 21, 2014 06:11
build mysql debug version
cmake -DCMAKE_INSTALL_PREFIX=/home/errord/mysql_debug -DMYSQL_DATADIR=/home/errord/mysql_debug/data/mysql/ -DSYSCONFDIR=/home/errord/mysql_debug/etc -DWITH_DEBUG=1 ../
@errord
errord / gist:99da00123f573c5c9f83
Created May 22, 2014 09:09
有几个和MySQL(尤其是InnoDB引擎)数据表设计相关的建议,希望开发者朋友能遵循
有几个和MySQL(尤其是InnoDB引擎)数据表设计相关的建议,希望开发者朋友能遵循:
a) 所有InnoDB数据表都创建一个和业务无关的自增数字型作为主键,对保证性能很有帮助;
b) 杜绝使用text/blob,确实需要使用的,尽可能拆分出去成一个独立的表;
c) 时间戳建议使用 TIMESTAMP 类型存储;
d) IPV4 地址建议用 INT UNSIGNED 类型存储;
e) 性别等非是即非的逻辑,建议采用 TINYINT 存储,而不是 CHAR(1);
f) 存储较长文本内容时,建议采用JSON/BSON格式存储;
@errord
errord / gist:cf14660541113ba9c2b3
Last active August 29, 2015 14:01
innodb check data file
5 in fil_check_first_page of /home/errord/opensource/mysql-5.6.17/storage/innobase/fil/fil0fil.cc:1989
=> in fil_read_first_page of /home/errord/opensource/mysql-5.6.17/storage/innobase/fil/fil0fil.cc:2065
7 in open_or_create_data_files of /home/errord/opensource/mysql-5.6.17/storage/innobase/srv/srv0start.cc:1003
6 in innobase_start_or_create_for_mysql of /home/errord/opensource/mysql-5.6.17/storage/innobase/srv/srv0start.cc:2051
9 in innobase_init of /home/errord/opensource/mysql-5.6.17/storage/innobase/handler/ha_innodb.cc:3267
10 in ha_initialize_handlerton of /home/errord/opensource/mysql-5.6.17/sql/handler.cc:662
11 in plugin_initialize of /home/errord/opensource/mysql-5.6.17/sql/sql_plugin.cc:1126
12 in plugin_init of /home/errord/opensource/mysql-5.6.17/sql/sql_plugin.cc:1417
13 in init_server_components of /home/errord/opensource/mysql-5.6.17/sql/mysqld.cc:4832
14 in mysqld_main of /home/errord/opensource/mysql-5.6.17/sql/mysqld.cc:5429
1. git颜色配置
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
2. git默认编辑器设置