Skip to content

Instantly share code, notes, and snippets.

View ypwu1's full-sized avatar
Powered by ⚰️

Oscar ypwu1

Powered by ⚰️
  • Melbourne
View GitHub Profile
@ypwu1
ypwu1 / .gitconfig
Last active August 29, 2015 14:06 — forked from pksunkara/config
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@ypwu1
ypwu1 / convert.sh
Last active March 19, 2021 10:07
Bash Script for converting video files by using ffmpeg
#!/bin/bash
#brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid
#$1 directory $2 input type $3 output type
#ffmpeg -i input.flv -vcodec libvpx -acodec libvorbis output.webm
find "$1" -type f -name "*.$2" | while read -r file; do
filename=$(basename "$file" ".$2")
dirname=$(dirname "$file")
ffmpeg -i "$dirname/$filename.$2" "$dirname/$filename.$3"
done
@ypwu1
ypwu1 / gist:4ffa9dfd3f35d4672134
Created December 29, 2014 15:02
convert_dvd.sh
#!/bin/bash
ffmpeg -i concat:"/Volumes/DVD_BUILD/VIDEO_TS/VTS_01_1.VOB|/Volumes/DVD_BUILD/VIDEO_TS/VTS_02_1.VOB|/Volumes/DVD_BUILD/VIDEO_TS/VTS_03_1.VOB|/Volumes/DVD_BUILD/VIDEO_TS/VTS_04_1.VOB" \
-acodec libfaac -aq 100 -ac 2 -vcodec libx264 -vpre slow -crf 24 -threads 0 output.mp4
@ypwu1
ypwu1 / git-aliases.md
Last active November 17, 2016 20:25 — forked from mwhite/git-aliases.md

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
[alias]
a = add .
ai = add -i
ac = !git add . && git commit -am
#############
ap = apply
as = apply --stat
#############
ama = am --abort
amr = am --resolved
@ypwu1
ypwu1 / introrx.md
Created February 2, 2016 11:25 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ypwu1
ypwu1 / angularjs_directive_attribute_explanation.md
Created May 3, 2016 02:00 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@ypwu1
ypwu1 / BrewBindInstallAndSetupMacOSX10_10.sh
Created July 5, 2016 13:17 — forked from mpaskalev/BrewBindInstallAndSetupMacOSX10_10.sh
Install and setup bind (named) on Mac OS X 10.10.1 with brew 0.9.5
#!/bin/bash
# Run as root or sudo the commands that need it as you go.
# brew version 0.9.5
# Mac OS X 10.10.1
# A little bit changed version of this:
# http://stackoverflow.com/questions/19538118/osx-mavericks-bind-no-longer-installed-how-to-get-local-dns-server-working
@ypwu1
ypwu1 / jenkins_haproxy_config.cfg
Created July 6, 2016 10:02 — forked from xelwarto/jenkins_haproxy_config.cfg
Jenkins CI haproxy configuration example
global
chroot /var/lib/haproxy
crt-base /etc/pki/tls/certs
daemon
group haproxy
log 127.0.0.1 local0
maxconn 2000
pidfile /var/run/haproxy.pid
stats socket /var/lib/haproxy/stats
tune.ssl.default-dh-param 2048
@ypwu1
ypwu1 / docker_command
Created May 11, 2017 20:40 — forked from likwid/docker_command
Postgres with ssl in docker
#This isn't very secure, but its for demo purposes
docker run --name postgres -e POSTGRES_PASSWORD=password -d -p 54320:5432 \
-v $(pwd)/postgresql.conf:/srv/postgresql.conf \
-v $(pwd)/server.crt:/srv/server.crt \
-v $(pwd)/server.key:/srv/server.key \
-v $(pwd)/reconfigure_postgres.sh:/docker-entrypoint-initdb.d/reconfigure_postgres.sh \
postgres:9.5