Skip to content

Instantly share code, notes, and snippets.

View jun1st's full-sized avatar
🎯
Focusing

feng qijun jun1st

🎯
Focusing
View GitHub Profile
@jun1st
jun1st / puma.monitrc
Created October 12, 2017 03:07 — forked from sudara/puma.monitrc
Example config needed to use monit with puma, monitoring workers for mem.
# this monit config goes in /etc/monit/conf.d
check process puma_master
with pidfile /data/myapp/current/tmp/puma.pid
start program = "/etc/monit/scripts/puma start"
stop program = "/etc/monit/scripts/puma stop"
group myapp
check process puma_worker_0
with pidfile /data/myapp/current/tmp/puma_worker_0.pid
@jun1st
jun1st / example.rb
Created March 4, 2016 15:44 — forked from JoshCheek/example.rb
Debug
# https://minhajuddin.com/2016/03/03/put-this-in-your-code-to-debug-anything
require 'rouge'
require 'method_source'
require 'pp'
class Dbg
def initialize(object, to:)
@object, @stream = object, to
end
#!/bin/bash
set -e
echo "Adding PPA for up-to-date Node.js runtime. Give your password when asked."
sudo add-apt-repository ppa:chris-lea/node.js
echo "Updates packages. Asks for your password."
sudo apt-get update -y
@jun1st
jun1st / setup_ubuntu_for_rails
Last active October 17, 2016 14:17
setup ubuntu for rails
sudo apt-get upgrade
sudo apt-get update -y
#add user for deploy,
sudo useradd -d /home/deployer -m deployer
sudo passwd deployer
sudo visudo
#deployer ALL=(ALL) ALL 把这个加入sudoer 文件中
@jun1st
jun1st / private.xml
Last active August 29, 2015 14:12 — forked from lucifr/private.xml
<?xml version="1.0"?>
<root>
<item>
<name>F19 to F19</name>
<appendix>(F19 to Hyper (ctrl+shift+cmd+opt) + F19 Only, F19)</appendix>
<identifier>private.f192f19</identifier>
<autogen>
--KeyOverlaidModifier--
KeyCode::F19,
KeyCode::COMMAND_L,
@jun1st
jun1st / vpnsetup.sh
Last active August 29, 2015 14:09 — forked from hwdsl2/.MOVED.md
#!/bin/sh
#
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN
# on a Ubuntu server instance. Tested with 14.04 (Trusty) AND 12.04 (Precise).
# With minor modifications, this script *can also be used* on dedicated servers
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers.
#
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN
# YOUR AMAZON EC2 INSTANCE STARTS!
#
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
./configure \
--add-module=$HOME/naxsi-0.53-2/naxsi_src \
--prefix=/usr/share/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/access.log \
--user=www-data \
class Article < ActiveRecord::Base
include Shareable
include Subscribable
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
def more_like_this
Topic.search(
query: {
more_like_this: {
@jun1st
jun1st / update_crontab.rb
Created January 22, 2014 03:47
update crontab with whenever
desc "update crotab with whenever"
task :update_crontab do
on roles(:all) do
within release_path do
execute :bundle, :exec, "whenever --update-crontab #{fetch(:whenever_identifier)} "
end
end
end