Skip to content

Instantly share code, notes, and snippets.

@samgooi4189
samgooi4189 / mysql_rails_console_fix
Created May 13, 2017 16:32
Solving mysql error for rails console
Sympthoms:
$ rails c
Running via Spring preloader in process 19704
Loading development environment (Rails 5.1.0)
2.4.0 :001 > User.connection
Mysql2::Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
from (irb):1
Fix:
@samgooi4189
samgooi4189 / git_reset_cheat
Created April 18, 2017 03:31
Clear git changes and unstaged files
# reset to HEAD
git reset HEAD --hard
# will remove unstaged files without removing gitignore file
git clean -fd
@samgooi4189
samgooi4189 / play_remote_video.sh
Created April 12, 2017 16:52
Play remote video via ssh with local vlc
#!/bin/bash
###
# This is a simple script to play video across ssh with VLC
###
if [[ -z $3 ]]; then
echo "Usage: play_remote_video.sh [username] [remote_address] [video_full_path]"
exit 1
fi
@samgooi4189
samgooi4189 / start_LAN
Created March 30, 2017 14:55
Fix Nvidia nForce MCP79 Ethernet
#!/bin/bash
sudo modprobe -rv forcedeth
sudo modprobe -v forcedeth msi=0 msix=0
sudo ethtool -s eth0 speed 100 duplex full autoneg off
@samgooi4189
samgooi4189 / setMinMaxButtonGnome.sh
Created January 22, 2017 15:00
Bring back minimize and maximize button on gnome
#!/bin/bash
gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close"
@samgooi4189
samgooi4189 / BCM43228reinstallDriver
Last active March 18, 2024 21:13
Fixing BCM43228 loading wrong driver
Under lspci -vv, I saw my wifi card bcm43228 is using wl module, but it is working weirdly, so I go inspect dmesg and found:
[ 17.135645] wl: module license 'MIXED/Proprietary' taints kernel.
[ 17.135648] Disabling lock debugging due to kernel taint
[ 17.137273] wl: module verification failed: signature and/or required key missing - tainting kernel
[ 17.227089] wlan0: Broadcom BCM4359 802.11 Hybrid Wireless Controller 6.30.223.248 (r487574)
[ 17.315644] wl 0000:03:00.0 wlp3s0: renamed from wlan0
linux is loading the wrong device for my wifi card.
so I search online and found https://ubuntuforums.org/archive/index.php/t-2209676.html
In short,
@samgooi4189
samgooi4189 / fixNetworkManager.txt
Last active January 5, 2017 17:19
How to fix no access point showing up at Network Manager
I am having issue with Network Manager in linux when I enable and disable my wifi through hardware switch.
All the accees points are not showing up in Network Manager, but I still connected to internet.
So here is what I do to get all access point listing issue fixed:
1. open /etc/NetworkManager/NetworkManager.conf and edit this:
managed=true
2. open /etc/network/interfaces and add this:
# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
auto wlp3s0
@samgooi4189
samgooi4189 / createBootableUSB.sh
Created December 10, 2016 16:40
create linux bootable usb
#!/bin/bash
# Usage:
# ./createBootableUSB.sh /path/to/distro.iso /dev/sdX
sudo apt-get update
sudo apt-get install syslinux syslinux-utils --y
sudo umount $2
isohybrid $1 --entry 4 --type 0x1c
sudo dd bs=8M if=$1 of=$2
@samgooi4189
samgooi4189 / bcm57765or57785fix
Last active May 11, 2025 10:29
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:
@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;