Skip to content

Instantly share code, notes, and snippets.

samgooi4189

Block or report user

Report or block samgooi4189

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@samgooi4189
samgooi4189 / step_to_add_kernel_jupyter
Created Aug 23, 2019
Add custom kernel to jupyter notebook
View step_to_add_kernel_jupyter
Make jupyter notebook to use virtualenv
1. virtualenv ENVNAME
2. source ./ENVNAME/bin/activate
3. pip install ipykernel
4. python -m ipykernel install --user --name ENVNAME --display-name "Python (whatever you want to call it)"
@samgooi4189
samgooi4189 / ubuntu_desktop_app
Created Aug 22, 2019
Create desktop shortcut for program in Ubuntu
View ubuntu_desktop_app
Create a file ( Desktop File ) with this content:
[Desktop Entry]
Version=1.0
Name=Android Studio
Type=Application
Icon=/PATH/TO/ICON/studio.png
Exec=/PATH/TO/studio.sh
Change /PATH/TO/ICON/studio.png and /PATH/TO/studio.sh accordingly.
save the file as: android-studio.desktop in /usr/share/applications
View find_out_duplicates_mp4.py
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 Jul 28, 2019
Convert files to mp4 with ffmpeg
View convert_file_to_mp4.py
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 Nov 22, 2018
Ubuntu check battery status
View UbuntuBatteryStatus.sh
#!/bin/bash
upower -i /org/freedesktop/UPower/devices/battery_BAT0
@samgooi4189
samgooi4189 / gcloudKeyToApp
Created Oct 24, 2018
Adding Google service account key to heroku or your app
View gcloudKeyToApp
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 Oct 1, 2018
getting public key from rvm
View rvm_fix_pgpkey
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 Sep 28, 2018
Create virtualenv kernel for jupyter notebook
View create_virtualenv_kernel_for_jupyter
python -m ipykernel install --user --name virtenv --display-name "Python (virtuenv)"
virtenv is the virtualenv name that you set for your project
View convert_ts_to_mp4.py
# 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 Jul 24, 2018 — forked from cortesben/hg-commands.md
Mercurial command cheat sheet
View hg-commands.md

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
You can’t perform that action at this time.