Skip to content

Instantly share code, notes, and snippets.

@mikemedina
mikemedina / download_calls.py
Last active October 8, 2015 12:00
Call Downloader
import datetime
import getpass
import os
import shutil
import time
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
@chuanying
chuanying / single_read_write_queue.cc
Last active December 27, 2015 22:39
生产者与消费者(单链表),一个单链表,有个表头和表尾,一个线程作为消费者每次从表头去一个元素,另一个线 程作为生产者每次从表尾加一个元素,不加锁如何实现?
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <thread>
#include <algorithm>
#include <stdio.h>
@wxianfeng
wxianfeng / slave.cnf
Created June 7, 2012 08:13
mysql 主从复制
# mysql主从复制,两台机器
# 主: 192.168.10.107 UBUNTU
# 从: 192.168.10.105 UBUNTU
# 主配置
>vim /etc/mysql/my.cnf
[mysqld]
log-bin=mysql-bin // 启用二进制日志
server-id=107 // 服务器唯一ID,一般取IP最后一段
bind-address=192.168.10.107

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@emk
emk / apache-logs-hive.sql
Created January 3, 2012 18:01
Apache log analysis with Hadoop, Hive and HBase
-- This is a Hive program. Hive is an SQL-like language that compiles
-- into Hadoop Map/Reduce jobs. It's very popular among analysts at
-- Facebook, because it allows them to query enormous Hadoop data
-- stores using a language much like SQL.
-- Our logs are stored on the Hadoop Distributed File System, in the
-- directory /logs/randomhacks.net/access. They're ordinary Apache
-- logs in *.gz format.
--
-- We want to pretend that these gzipped log files are a database table,
@swannodette
swannodette / gist:1277285
Created October 11, 2011 04:32
post_advanced.js
var e = void 0, f = true, g = null, i = false;
function j() {
return function() {
}
}
function k(a) {
return function() {
return this[a]
}
}
@dataminelab
dataminelab / unique_visitors.ql
Created June 27, 2011 21:42
Unique visitors HiveQL
ADD JAR ${CODE}/hive/udf/md5.jar;
CREATE TEMPORARY FUNCTION mymd5 AS 'com.dataminelab.hive.udf.Md5';
SELECT
DISTINCT mymd5(user_id)
FROM page_views
WHERE
substr(mymd5(user_id), -2) == '00';
@pingles
pingles / haproxy
Created May 3, 2011 18:39
Using HAProxy to balance Hive service requests across multiple backends
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 1000
daemon
user haproxy
group haproxy
defaults
log global
@fanzeyi
fanzeyi / .vimrc
Created December 25, 2010 09:24
vim配置文件
" VIM配置文件
" Author: Fanzeyi (fanzeyi1994[at]gmail.com)
" Last Modified Date: 2010-10-13 17:49
" 设置语言及编码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
set enc=utf-8
" set fencs=utf-8,ucs-bom,gbk,gb18030,shift-jis,gb2312,cp936