Skip to content

Instantly share code, notes, and snippets.

View sqd's full-sized avatar

Han You sqd

  • U of Michigan, Ann Arbor
  • Colorado Springs, Colorado, US
View GitHub Profile
@sqd
sqd / normalize.py
Created November 11, 2020 02:53
normalize pager output
#!/usr/bin/python
import sys
import re
input_str = sys.stdin.read()
shell_pid = re.compile(r'vm_create\t\((\d+)').search(input_str).group(1)
shell_pid = shell_pid
pid_list = [shell_pid]
for match in re.finditer(r'vm_create\t\((\d+), (\d+)\)', input_str):
rofi usage:
rofi [-options ...]
Command line only options:
-no-config Do not load configuration, use default values.
-v,-version Print the version number and exit.
-dmenu Start in dmenu mode.
-display [string] X server to contact.
${DISPLAY}
-h,-help This help message.
@sqd
sqd / timelapse.md
Created August 8, 2018 18:54 — forked from alexellis/timelapse.md
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution

Slower, better quality

@sqd
sqd / CCWebcam.py
Created August 8, 2018 02:11
capture colorado college webcam
#!/usr/bin/python2
import pafy
import cv2
url = '8XFlf22-46s'
vpafy = pafy.new(url)
play = vpafy.getbest()
cap = cv2.VideoCapture(play.url)