Skip to content

Instantly share code, notes, and snippets.

@samgooi4189
samgooi4189 / Prompt color
Created February 7, 2015 10:00
Bash text color
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
@samgooi4189
samgooi4189 / gist:d674547448e60ec42769
Created April 24, 2015 02:18
[Solution] Whitespace trailing remove on Atom
For Atom editor, the whitespace trailing removal is activated as default, which is annoying because it overrides your files without telling you then cause massive git diff in your project.
To disable this:
1. Go to Edit >> Preferences
2. Select Packages, search for whitespace, then click edit
3. untick Remove Trailing Whitespace
You are good to go.
@samgooi4189
samgooi4189 / pg cheatsheets
Last active December 29, 2022 17:26
postgres cheatsheets
===To enter pg with user postgres===
sudo su
su postgres
psql
-- to create roles --
CREATE ROLES username PASSWORD 'password' INHERIT LOGIN
-- to alter roles --
ALTER ROLES username [SUPERUSER/CREATEDB/CREATEROLE]
===To see current connection, user, password (host:port:db:user:password)===
@samgooi4189
samgooi4189 / iAtkosS3
Created July 23, 2015 16:05
Installation guide for installing OSX 10.6.7 for BenQ S41
Download iAtkos S3v2
Restore iAtkos S3 image to USB
Install Chameleon into USB
Boot iAtkos S3 USB with -v -x
Chameleon RC5, GraphicsEnabler=Yes, RTCFix, USBBusFix, VoodooHDA, PS2, dont pick VoodooBattery
After installation, boot with -v -x (remember to connect USB mouse and keyboard)
After setting up, reboot
@samgooi4189
samgooi4189 / aapt fix for android studio
Created February 25, 2016 15:29
Fixing Cannot run command "/home/user_name/Android/Sdk/build-tools/21.1.2/aapt"
If you are using Ubuntu or Debian which runs on 64-bit architecture, try to install the following package:
sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1
The program requires these package so that it could run in 64-bit environment.
@samgooi4189
samgooi4189 / .bashrc
Created August 21, 2016 08:08
How to view git branch in bash
# Add git branch if its present to PS1
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
fi
@samgooi4189
samgooi4189 / rtl8191se_fix
Last active September 6, 2016 00:56
Make rtl8191se works better
$ sudo add-apt-repository ppa:hanipouspilot/rtlwifi
$ sudo apt-get update
$ sudo apt-get install rtlwifi-new-dkms linux-firmware
$ sudo modprobe -r rtl8192se
$ sudo modprobe -v rtl8192se ips=N fwlps=N swlps=N debug=1 disable_watchdog=Y swenc=Y
$ echo 'options rtl8192se ips=N fwlps=N swlps=N debug=1 disable_watchdog=Y swenc=Y' | sudo tee /etc/modprobe.d/rtl8192se.conf
This will make rtl8191SEvA work better in Ubuntu.
To see what options are available in rtl8192se, you can
@samgooi4189
samgooi4189 / turn_off_power_management_ubuntu
Last active January 21, 2023 18:36
Turn off power management for Ubuntu wifi
To temporarily disable power management
$ sudo /sbin/iwconfig wlan0 power off
To turn off power management permanently
$ sudo vim /etc/pm/power.d/wireless
"""
#!/bin/sh
/sbin/iwconfig wlan0 power off
"""
@samgooi4189
samgooi4189 / Makefile
Created October 11, 2016 18:20
Improve wifi makefile
# set regional to BO (Bolivia) since they allow use of 1000 mW tx-power
set-bo:
sudo ifconfig wlan0 down
sudo iw reg set BO
sudo ifconfig wlan0 up
iwconfig wlan0
# Side effects:
# overheating of the power amplifier chip and the card which will cause lower efficiency and more data errors;
# overdriving the amplifier which will cause more data errors;
@samgooi4189
samgooi4189 / bcm57765or57785fix
Last active April 19, 2024 04:20
Fixing Broadcom Corporation BCM57765/57785 SDXC/MMC Card Reader
Follow the WORKAROUND:
1. Add a comand to /etc/rc.local, add the following line above "exit 0":
setpci -s 00:1c.2 0x50.B=0x41
2. Add the same comand to /etc/apm/resume.d/21aspm (which does not exist yet):
setpci -s 00:1c.2 0x50.B=0x41
3. Add the following to /etc/modprobe.d/sdhci.conf:
options sdhci debug_quirks2=4
4. Re-generate initrd:
sudo update-initramfs -u -k all
5. Reboot or reload sdhci module: