Skip to content

Instantly share code, notes, and snippets.

@yaoyi
yaoyi / queue.c
Created February 4, 2013 15:57
环形队列实现
/**
* @file queue.c
* @brief 基本的队列实现
* @author linyaoyi
* @version 1.1
* @date 2012-01-16
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@yaoyi
yaoyi / app.js
Created May 23, 2013 01:37 — forked from elranu/app.js
//app.js Socket IO Test
var app = require('express').createServer(),
redis = require('socket.io/node_modules/redis'),
io = require('socket.io').listen(app);
var pub = redis.createClient(port, "url");
var sub = redis.createClient(port, "url");
var store = redis.createClient(port, "url");
pub.auth('pass', function(){console.log("adentro! pub")});
sub.auth('pass', function(){console.log("adentro! sub")});
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
cd /tmp
wget http://ruby.taobao.org/mirrors/ruby/1.9/ruby-1.9.3-p429.tar.gz
tar -xvzf ruby-1.9.3-p429.tar.gz
cd ruby-1.9.3-p429/
./configure --prefix=/usr/local --disable-install-rdoc
make
@yaoyi
yaoyi / deploy-s1.sh
Last active December 19, 2015 12:39
rails deployment
# root用户
# 更新系统
apt-get -y update
apt-get -y install curl git-core python-software-properties
# 安装nginx
add-apt-repository ppa:nginx/stable
apt-get -y update
apt-get -y install nginx
service nginx start
# 安装Node.js
@yaoyi
yaoyi / l2tp.sh
Last active June 21, 2016 04:44
ubuntu-12.04LTS配置VPN(L2TP/IPSec)
#!/bin/bash
if [ $(id -u) != "0" ]; then
printf "Error: You must be root to run this tool!\n"
exit 1
fi
clear
printf "
####################################################
# #
@yaoyi
yaoyi / Gemfile
Created August 13, 2013 07:19
sinatra + mongoid 的 CRUD
source 'http://rubygems.org'
gem 'rack'
gem 'rack-flash'
gem 'thin'
gem 'sinatra', :require => 'sinatra/base'
gem 'mongoid'
gem 'bson_ext'
gem 'slim'
@yaoyi
yaoyi / post.py
Last active December 21, 2015 09:28
import cookielib
import socket
import urllib
import urllib2
url = 'http://www.mitfahrgelegenheit.de/mitfahrzentrale/Dresden/Potsdam.html/'
http_header = {
"User-Agent" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11",
"Accept" : "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,text/png,*/*;q=0.5",
"Accept-Language" : "en-us,en;q=0.5",
require "net/http"
require "uri"
require 'json'
# http://checkcosmetic.net
# uri = URI.parse("http://checkcosmetic.net/wp-admin/admin-ajax.php")
# http://cosmetic.momoko.hk
uri = URI.parse("http://cosmetic.momoko.hk/calculate.php")
#! /bin/sh
mkdir .tmp
cd .tmp
wget https://github.com/sunspot/sunspot/archive/v2.0.0.pre.130115.zip
unzip v2.0.0.pre.130115.zip
mv sunspot-2.0.0.pre.130115 sunspot
wget http://mmseg4j.googlecode.com/files/mmseg4j-1.8.5.zip
unzip mmseg4j-1.8.5.zip -d mmseg4j
cp -r sunspot/sunspot_solr/solr ../sunspot_solr_mmseg4j
mkdir -p WEB-INF/lib
@yaoyi
yaoyi / Gemfile
Created September 22, 2013 02:39 — forked from HungYuHei/Gemfile
用redis实现了用户之前互相follow
# Gemfile
gem 'redis', '~> 3.0.1'