I hereby claim:
- I am kfei on github.
- I am kfei (https://keybase.io/kfei) on keybase.
- I have a public key ASBqABPMn4hnjXBn2PWO0agEIH4aBQoD7rqrykOtLG576go
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// With naturalWidth, naturalHeight | |
myImage.addEventListener('onload', function() { | |
console.log('My width is: ', this.naturalWidth); | |
console.log('My height is: ', this.naturalHeight); | |
}); | |
// Without naturalWidth, naturalHeight | |
function realImgDimension(img) { | |
var i = new Image(); | |
i.src = img.src; |
# Create new array | |
mdadm --zero-superblock /dev/sd{a,b} | |
mdadm -C --level 1 /dev/md1 -n 2 /dev/sda2 /dev/sdb2 | |
# Save to mdadm.conf since it will be used in initramfs for assembling arrays | |
mdadm --detail --scan >> /etc/mdadm.conf | |
# Make new file system and then migrate data | |
rsync -avxHAXS -P / /mnt/md1 |
# -*- coding: utf-8 -*- | |
# Define here the models for your scraped items | |
# | |
# See documentation in: | |
# http://doc.scrapy.org/en/latest/topics/items.html | |
import scrapy | |
(pprof) top10 | |
130ms of 130ms total ( 100%) | |
Showing top 10 nodes out of 11 (cum >= 80ms) | |
flat flat% sum% cum cum% | |
60ms 46.15% 46.15% 60ms 46.15% math.Sqrt | |
20ms 15.38% 61.54% 80ms 61.54% github.com/kfei/sshcam/img2xterm.cie94 | |
20ms 15.38% 76.92% 20ms 15.38% runtime.usleep | |
10ms 7.69% 84.62% 10ms 7.69% retake | |
10ms 7.69% 92.31% 10ms 7.69% runtime.cas64 | |
10ms 7.69% 100% 10ms 7.69% runtime.nanotime |
# 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 |
#!/bin/bash | |
docker run -it --rm --privileged --net host \ | |
-v /tmp/.X11-unix:/tmp/.X11-unix \ | |
-v $PWD:$HOME/workspace \ | |
-v $HOME/.Xauthority:$HOME/.Xauthority \ | |
-e HOME=$HOME \ | |
-e DISPLAY=$DISPLAY \ | |
--entrypoint /usr/sbin/ffmpeg \ | |
kfei/ffmpeg $* |
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) | |
} |
# Use ffmpeg to decode input video (GIF in this case) | |
ffmpeg -i input.gif decode/%d.png | |
# Use ImageMagick to crop, format: (W)x(H)+(W_SFHIT)+(H_SHIFT) | |
# Note the {from..to..skip} usage of Bash | |
convert decoded/{1..759..5}.png -crop 315x172+20+40 resized/%d.png | |
# An resize option | |
# convert decoded/{1..759..5}.png -crop 315x172+20+40 -resize 30% resized/%d.png |
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 \ |