Skip to content

Instantly share code, notes, and snippets.

@samgooi4189
samgooi4189 / find_out_duplicates_mp4.py
Created July 28, 2019 09:42
Find out duplicates mp4
import glob
import re
import os
target_directory ="./output"
source_directory = "."
target_filenames = [os.path.basename(x) for x in glob.glob("%s/*.mp4" % target_directory)]
source_filenames = [os.path.basename(x) for x in glob.glob("%s/*.mp4" % source_directory)]
@samgooi4189
samgooi4189 / convert_file_to_mp4.py
Created July 28, 2019 09:41
Convert files to mp4 with ffmpeg
import glob
import re
import os
EXTENSION = "flv"
for filename in glob.iglob("*.%s" % EXTENSION):
filename_without_extension = re.search("(.*).%s" % (EXTENSION) , filename).group(1)
if filename_without_extension:
print(filename_without_extension)
@samgooi4189
samgooi4189 / UbuntuBatteryStatus.sh
Created November 22, 2018 13:15
Ubuntu check battery status
#!/bin/bash
upower -i /org/freedesktop/UPower/devices/battery_BAT0
@samgooi4189
samgooi4189 / gcloudKeyToApp
Created October 24, 2018 07:20
Adding Google service account key to heroku or your app
set the environment variable to the path of your gcloud service account key:
GOOGLE_APPLICATION_CREDENTIALS=‘config/keyFile.json’
@samgooi4189
samgooi4189 / rvm_fix_pgpkey
Created October 1, 2018 10:44
getting public key from rvm
On the official rvm website,
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Sometimes it will fails due to firewall, so you need to add port 80 at the end of url
gpg --keyserver hkp://keys.gnupg.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
@samgooi4189
samgooi4189 / create_virtualenv_kernel_for_jupyter
Created September 28, 2018 11:27
Create virtualenv kernel for jupyter notebook
python -m ipykernel install --user --name virtenv --display-name "Python (virtuenv)"
virtenv is the virtualenv name that you set for your project
@samgooi4189
samgooi4189 / convert_ts_to_mp4.py
Created August 3, 2018 04:10
Convert ts to mp4
# Usage: python3 convert_ts_to_mp4.py
import glob
import os
for filename in glob.iglob('*.ts'):
print('\nConverting %s to mp4..........................' % filename)
name = filename.split(".ts")[0]
os.system("ffmpeg -i %s -acodec copy -vcodec copy %s.mp4 " % (filename,name))
@samgooi4189
samgooi4189 / hg-commands.md
Last active July 24, 2018 16:14 — forked from cortesben/hg-commands.md
Mercurial command cheat sheet

Mercurial Commands

Commands Description
hg pull get latest changes like git pull use flags like -u IDK why yet
hg add only for new files
hg commit add changes to commit with -m for message just like git
hg addremove adds new files and removes file not in your file system
hg incoming see changes commited by others
hg outgoing see local commits
@samgooi4189
samgooi4189 / External mic for Ubuntu
Created June 26, 2018 15:48
Fix external mic for Ubuntu
sudo vim /etc/modprobe.d/alsa-base.conf
paste the following to the last line:
options snd-hda-intel model=dell-headset-multi
@samgooi4189
samgooi4189 / debugReactNativeAndroidRemotely
Created May 3, 2018 06:46
Debug react native on android remotely
Question: How to debug reactnative JS remotely in android?
Solution:
Start up your android vm/ emulator
Navigate to you project folder and in terminal, type “react-native run-android”
Open chrome and visit localhost:8081/debugger-ui
In terminal, type “adb shell input keyevent 82” , to bring up the dev menu
Select “debug JS remotely”
Refresh chrome
Press ‘r’ two times in the android vm