Skip to content

Instantly share code, notes, and snippets.

@yaoyi
yaoyi / zsh.md
Created October 16, 2013 06:42 — forked from tsabat/zsh.md
<!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 / 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
@yaoyi
yaoyi / Gemfile
Created February 7, 2014 14:30 — forked from zernel/Gemfile
gem 'devise'
gem 'omniauth'
gem 'omniauth-github'
gem "omniauth-twitter"
gem "omniauth-facebook"
gem "omniauth-google-oauth2"
@yaoyi
yaoyi / README.md
Created February 13, 2014 14:39 — forked from nicerobot/README.md

To run this, you can try:

curl -ks https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh | bash

I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this one'll work too.

Alternatively,

curl -ksO https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh

chmod +x ./uninstall-node.sh

from datetime import datetime
from hashlib import md5
from scrapy import log
from scrapy.exceptions import DropItem
from twisted.enterprise import adbapi
class FilterWordsPipeline(object):
"""A pipeline for filtering out items which contain certain words in their
description"""
# put this in config/initializers/carrierwave.rb
module CarrierWave
module MiniMagick
def quality(percentage)
manipulate! do |img|
img.quality(percentage)
img = yield(img) if block_given?
img
end
end
desc "Backup the database"
namespace :db do
task :backup do
on roles(:db) do |host|
backup_path = "#{fetch(:deploy_to)}/backups"
execute :mkdir, "-p #{backup_path}"
basename = 'database'
username, password, database, host = get_remote_database_config(fetch(:stage))
debug "#{username}, #{password}, #{database}"
@yaoyi
yaoyi / gist:eb578f9432e7c7626a2274c40e064010
Created December 26, 2016 13:30
rsync同步服务器数据到本地
rsync -azv -e "ssh -p 20202" user@host:/src/ dest