Skip to content

Instantly share code, notes, and snippets.

View perfectfoolish's full-sized avatar
🎯
Focusing

Fulei Li perfectfoolish

🎯
Focusing
View GitHub Profile
@perfectfoolish
perfectfoolish / bash_profile
Last active September 23, 2015 06:54
brew install bash-completion
export PATH=/usr/local/bin:$PATH
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
if which rbenv > /dev/null; then
eval "$(rbenv init -)"
fi
require 'socket'
require 'nokogiri'
host = 'www.so.com'
port = 80
path = "http://www.so.com/s?psid=aa1636dc9ced822ddb741bd94af183fc&q=%E8%89%BA%E9%BE%99&pq=%E8%89%BA%E9%BE%99&src=srp&fr=360sou_newhome"
request = "GET #{path} HTTP/1.0\r\n\r\n"
socket = TCPSocket.open(host, port)
socket.print(request)
@perfectfoolish
perfectfoolish / http_ser.py
Created April 19, 2014 13:08
http server
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
#=============================================================================
# FileName: http_ser.py
# Desc: http server
# Author: Sungis
# Email: [email protected]
# HomePage: http://sungis.github.com
# Version: 0.0.1
@perfectfoolish
perfectfoolish / check_root.sh
Created April 16, 2014 07:07
How to: Check the bash shell script is being run by root or not
http://www.cyberciti.biz/tips/shell-root-user-check-script.html
Sometime it is necessary to find out if a shell script is being run as root user or not.
When user account created a user ID is assigned to each user. BASH shell stores the user ID in $UID variable. Your effective user ID is stored in $EUID variable. You can
Old way...
You can easily add a simple check at the start of a script:
@perfectfoolish
perfectfoolish / clean_process.sh
Created January 10, 2014 07:05
50 23 * * * git /home/git/temp_clean/clean_process.sh >> /home/git/temp_clean/log/clean_process.log 2>&1
#! /bin/bash
ps -ef | grep ssh_rpc | awk '{print $2,$5}'| grep -v :| awk '{print "kill",$1}' > /home/git/temp_clean/clean_exec.sh
chmod +x /home/git/temp_clean/clean_exec.sh
/home/git/temp_clean/clean_exec.sh

I just had to set up Jenkins to use GitHub. My notes (to myself, mostly):

Detailed Instructions

For setting up Jenkins to build GitHub projects. This assumes some ability to manage Jenkins, use the command line, set up a utility LDAP account, etc. Please share or improve this Gist as needed.

Install Jenkins Plugins

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.
@perfectfoolish
perfectfoolish / jenkins.sh
Created November 25, 2013 08:27
When using SSL, you might want to use something like the below nginx config. Terminate SSL connection at nginx Proxy it internally to Jenkins on port 8080 Replace the Location Header of Jenkins with https instead of http Note that the third point is pretty tricky. We use proxy_redirect http:// https://; that corresponds to Apaches's ProxyPassRev…
upstream jenkins {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80 default;
server_name 127.0.0.1 *.mydomain.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
sudo aptitude -y install nginx
cd /etc/nginx/sites-available
sudo rm default
sudo cat > jenkins
upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
class Person
def initialize(feeling= "normal")
@feeling= feeling
end
def feed(dog)
dog.eat
end