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 / 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
@samgooi4189
samgooi4189 / External mic for Ubuntu
Created Jun 26, 2018
Fix external mic for Ubuntu
View 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
Debug react native on android remotely
View debugReactNativeAndroidRemotely
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
@samgooi4189
samgooi4189 / method_def_ruby
Created Apr 18, 2018
method definition in ruby, colon vs equals
View method_def_ruby
$ irb
2.4.3 :001 > def foo(a:1, b:2)
2.4.3 :002?> print "#{a}#{b}"
2.4.3 :003?> end
=> :foo
2.4.3 :004 > def foobar(a:1, b:2)
2.4.3 :005?> foo(a,b)
2.4.3 :006?> end
=> :foobar
2.4.3 :007 > foobar(3,4)
@samgooi4189
samgooi4189 / weird_rspec_error
Created Apr 3, 2018
AbstractController::ActionNotFound: The action 'index' could not be found for
View weird_rspec_error
I am seeing this error after running rspec:
Failure/Error: raise ActionNotFound, "The action '#{action}' could not be found for #{self.class.name}"
AbstractController::ActionNotFound:
The action 'index' could not be found for Api::V1::ExpertSchedulesController
All other routes are not throwing error in the controller.
You can’t perform that action at this time.