Skip to content

Instantly share code, notes, and snippets.

@justqyx
justqyx / manage-etc-hosts.sh
Last active August 10, 2021 16:50 — forked from irazasyed/manage-etc-hosts.sh
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
#!/bin/sh
# PATH TO YOUR HOSTS FILE
ETC_HOSTS=/etc/hosts
# DEFAULT IP FOR HOSTNAME
IP="127.0.0.1"
# Hostname to add/remove.
HOSTLINE=$2
@justqyx
justqyx / gist:9a100165a8cb05b8b95140ef2fbf06d7
Created July 13, 2016 12:54 — forked from jugyo/gist:3882497
nginx + ngx_lua on Mac
@justqyx
justqyx / deploy.rb
Created April 24, 2014 03:58 — forked from kirs/deploy.rb
# Capistrano configuration
#
# require 'new_relic/recipes' - Newrelic notification about deployment
# require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production.
# set :deploy_via, :remote_cache - fetch only latest changes during deployment
# set :normalize_asset_timestamps - no need to touch (date modification) every assets
# "deploy:web:disable" - traditional maintenance page (during DB migrations deployment)
# task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- Inspired by
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html
-- http://ssql-pgaustin.herokuapp.com/#1
-- JSON Types need to be mapped into corresponding PG types
--
@justqyx
justqyx / solr_cap.md
Last active December 22, 2016 03:44 — forked from doitian/solr_cap.rb

这是从其他地方 fork 过来的部署脚本(deploy.rb 部分代码)

namespace :deploy do
  task :setup_solr_data_dir do
    run "mkdir -p #{shared_path}/solr/data"
  end
end

namespace :solr do
@justqyx
justqyx / rack_p3p.rb
Last active December 17, 2015 09:58 — forked from jhjguxin/application.rb
#userful gem [rack-p3p](https://github.com/hoopla/rack-p3p)
# [ie_iframe_cookies](https://github.com/grosser/ie_iframe_cookies)
# encoding: utf-8
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_p3p
def set_p3p
headers['P3P'] = "policyref=\"/w3c/p3p.xml\", CP=\"ALL DSP COR CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT\""
end