Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / InvestigateDeviseParameterSanitizerr
Created July 15, 2017 09:41
Why devise_parameter_sanitizer.sanitize return empty params? [Solved]
Problem:
(byebug) devise_parameter_sanitizer.sanitize(:sign_up)
{}
Investigation:
1. We post the data to the backend in this format
```
$ curl -X POST -H "Content-Type: application/json" --data "{\"user\": {\"email\":\"abc@abc.com\", \"password\": \"1234567890\", \"password_confirmation\": \"1234567890\"}}" localhost:3000/api/v1/users
```
@samgooi4189
samgooi4189 / gooi_bot.rb
Last active August 1, 2017 13:48
gooi_bot
class GooiBot < RTanque::Bot::Brain
NAME = 'gooi_bot'
include RTanque::Bot::BrainHelper
MAX_RAND_DIVISION = 10.0
def tick!
## main logic goes here
@current_heading ||= sensors.heading