Skip to content

Instantly share code, notes, and snippets.

@yaoyi
yaoyi / citus_cheatsheet.sql
Created October 13, 2019 03:51 — forked from sfriquet/citus_cheatsheet.sql
Citus Cheatsheet
-- Set number of shard
ALTER DATABASE citus SET citus.shard_count = 64;
-- Explain across all shards
SET citus.explain_all_tasks TO true;
-- Size of all distributed tables excluding indexes but including TOAST, free space map, and visibility map
SELECT logicalrelid::text tablename, pg_size_pretty(citus_table_size(logicalrelid::text)) size FROM pg_dist_partition group by tablename;
-- Size of all distributed tables including all indexes and TOAST data
# 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
@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

@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"
<!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'
@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'
#!/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