This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Resolve all dependencies for packages that are going to be installed | |
for pkg in "virt-top cifs-utils redhat-lsb"; do repoquery --requires --resolve --recursive $pkg | grep -vE "i686" > dep-for-$pkg.log | |
# For a .rpm file, resolving dependencies can be `rpm -qpR mediawiki-1.4rc1-4.i586.rpm` | |
# Remove duplicates | |
awk '!x[$0]++' `cat dep-for-$pkg.log` > all-deps.log | |
# Extract package name from .deb file name | |
awk -F ":" '{print $1}' all-deps.log | sed -e 's/-[[:digit:]]\+$//g' > deps.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
args := os.Args | |
arg := make([](*_Ctype_char), 0) | |
l := len(args) | |
for i, _ := range args { | |
char := C.CString(args[i]) | |
// defer C.free(unsafe.Pointer(char)) | |
strptr := (*_Ctype_char)(unsafe.Pointer(char)) | |
arg = append(arg, strptr) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RUN buildDeps='gcc libc6-dev make'; \ | |
set -x \ | |
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& mkdir -p /usr/src/redis \ | |
&& curl -sSL "$REDIS_DOWNLOAD_URL" -o redis.tar.gz \ | |
&& echo "$REDIS_DOWNLOAD_SHA1 *redis.tar.gz" | sha1sum -c - \ | |
&& tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1 \ | |
&& rm redis.tar.gz \ | |
&& make -C /usr/src/redis \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# burn your 4 cores | |
for i in 1 2 3 4; do while : ; do : ; done & done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addrs bits pref mask | |
1 0 /32 255.255.255.255 | |
2 1 /31 255.255.255.254 | |
4 2 /30 255.255.255.252 | |
8 3 /29 255.255.255.248 | |
16 4 /28 255.255.255.240 | |
32 5 /27 255.255.255.224 | |
64 6 /26 255.255.255.192 | |
128 7 /25 255.255.255.128 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing | |
def thread_func(): | |
print "thread in" | |
while True: | |
pass | |
if __name__ == "__main__": | |
t1 = multiprocessing.Process(target = thread_func) | |
t1.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import threading | |
import Queue | |
import commands | |
import time | |
# thread class to run a command |
NewerOlder