Skip to content

Instantly share code, notes, and snippets.

View perfectfoolish's full-sized avatar
🎯
Focusing

perfectfoolish

🎯
Focusing
View GitHub Profile
def call_block
puts "Start of method"
yield
yield
yield
puts "End of method"
end
@perfectfoolish
perfectfoolish / menu.sh
Created October 15, 2013 10:26
put this script in /usr/local/bin/, make it a command
#!/bin/bash
echo -e "\n MENU\n"
echo "1 machinename"
echo "2 machinename"
echo "3 machinename"
echo "4 machinename"
echo "5 machinename"
echo "6 machinename"
#echo -n "Enter you select(1 2 3 4 or 5):"
#/bin/bash
#########################################
#Function: auto fdisk
#Usage: bash auto_fdisk.sh
#Author: Customer service department
#Company: Alibaba Cloud Computing
#Version: 2.0
#########################################
count=0
@perfectfoolish
perfectfoolish / logrotate.conf
Created November 8, 2013 06:34
logrotate.conf refer to http://ruby-china.org/topics/3704 and manpage of logrotate
/home/git/labhub/log/*.log {
daily
missingok
rotate 5
compress
dateext
delaycompress
notifempty
copytruncate
lastaction
class Person
def initialize(feeling= "normal")
@feeling= feeling
end
def feed(dog)
dog.eat
end
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;
@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;
}

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.

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

@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