Skip to content

Instantly share code, notes, and snippets.

@yaoyi
yaoyi / schema-sunspot.xml
Created December 25, 2013 06:20
solr schema for sunspot
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
<!doctype html>
<html ng-app="Demo" ng-controller="AppController">
<head>
<meta charset="utf-8" />
<title>
Lazy Loading Images With AngularJS
</title>
<style type="text/css">
@yaoyi
yaoyi / zsh.md
Created October 16, 2013 06:42 — forked from tsabat/zsh.md
@yaoyi
yaoyi / Gemfile
Created September 22, 2013 02:39 — forked from HungYuHei/Gemfile
用redis实现了用户之前互相follow
# Gemfile
gem 'redis', '~> 3.0.1'
#! /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
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")
@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",
@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 / 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 / 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