Skip to content

Instantly share code, notes, and snippets.

View larrycai's full-sized avatar
💭
I may be slow to respond.

Larry Cai larrycai

💭
I may be slow to respond.
View GitHub Profile
@larrycai
larrycai / README.mkd
Last active August 29, 2015 14:02
rpmbuild for auto-create buildroot

rpmbuild

Check how to build the rpm package from existing packages

$ tar -zcvf ~/wget.tar.gz /usr/bin/wget
$ rpm -bb wget.spec

I got message like below, my questions is why line mkdir /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64 is executed automatically

Since in the redhat 6.4 docker container, the folder will not be created automatically

@larrycai
larrycai / Dockerfile
Created July 4, 2014 00:21
docker's Dockerfile
FROM ubuntu:latest
RUN apt-get update
MAINTAINER Larry Cai "larry.caiyu@gmail.com"
RUN apt-get install -y curl make
RUN curl https://get.docker.io/builds/Linux/x86_64/docker-latest -o /usr/local/bin/docker
RUN chmod +x /usr/local/bin/docker
@larrycai
larrycai / Dockerfile
Created March 19, 2015 15:16
Simple Dockefile
FROM ubuntu:trusty
RUN apt-get update && apt-get install -y apache2
@larrycai
larrycai / long_duration.groovy
Last active August 29, 2015 14:27
Some groovy scripts for running jobs which executed time is longer than expected, also waiting time in queue
import groovy.json.JsonBuilder
import org.apache.commons.httpclient.*
import org.apache.commons.httpclient.methods.*
import hudson.model.Queue.Executable
int WARNING_DURATION_IN_SECONDS = 100 * 2 // 6 hours
dashing_url="http://172.17.0.2:3030/widgets/events"
def busyExecutors = Jenkins.instance.computers
.collect {
@larrycai
larrycai / cross-execution.py
Created September 21, 2010 04:52
cross platform execution in python
# call markdown to convert markdown -> html in memory
def mkd2html(inFilename):
#
# and there are different ways to handle windows and unix
# also subprocess.check_output exist in python27 only.
#
cmd = []
# mostly msysgit is used, cygwin, it is win32 platform
if sys.platform == "win32":
# i may need to check cygwin as well
@larrycai
larrycai / pom.xml
Created April 28, 2011 07:08
embed winstone for web application in maven
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- file is based on jenkin's solution https://github.com/jenkinsci/jenkins/commit/f0fa10bd63487e8754c678f2984e5bd655a51aa6
& latest pom.xml
https://github.com/jenkinsci/jenkins/blob/master/war/pom.xml
-->
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.demo</groupId>
<artifactId>helloworld2-war</artifactId>
@larrycai
larrycai / boot.sh
Created July 11, 2011 05:05
create virtual machine (kvm) for ubuntu
# This script will run as root the first time the virtual machine boots
#
# set proxy if needed
sudo echo "http_proxy=http://proxy.server/" >> /etc/environment
export http_proxy=http://proxy.server:8080/
## #Expire the user account
apt-get update
apt-get upgrade
@larrycai
larrycai / p1.py
Created October 13, 2011 00:47
solution for problem 1
# http://projecteuler.net/problem=1
total = 0;
for i in range(1,1000):
if (i % 3 == 0) or (i % 5 ==0):
# print i;
total += i;
print "the sum of all the multiples of 3 or 5 below 1000: " , total
@larrycai
larrycai / p2.py
Created October 13, 2011 01:02
solution for problem 2
# http://projecteuler.net/problem=2
total = 0;
a,b = 0,1
while a<4000000:
a,b = b,a+b
if a %2 == 0:
print a;
total += a;
print total
@larrycai
larrycai / p1.py
Created October 13, 2011 02:04
http://projecteuler.net solutions in python
# solution from http://weibo.com/1937408130
total = sum([x for x in range(1,1000) if x % 3 == 0 or x % 5 == 0])
print total