Skip to content

Instantly share code, notes, and snippets.

@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:
@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 / transmission-samba-simple.txt
Last active March 19, 2023 08:54
setup trasmission and samba on antix debian
1. install transmission-daemon and samba
2. mkdir /transmission-share
3. sudo usermod -a -G debian-transmission $(whoami)
4. sudo chgrp debian-transmission /transmission-share
5. sudo chmod 770 /transmission-share
6. sudo vim /etc/transmission-daemon/settings.json
change download_dir to /transmission-share
change umask from 18 to 2
append rpc-whitelist with 192.168.*.*
reference: https://askubuntu.com/questions/221081/permission-denied-when-downloading-with-transmission-daemon
@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 / 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 / sample.txt
Last active May 5, 2022 13:55
wget file from private repo
bitbucket does not send challenge https://developer.atlassian.com/server/bitbucket/how-tos/example-basic-authentication/#supplying-basic-auth-headers
$ wget --http-user="samgooi4189" --http-password="MpBrJa9dC3vkWgmTcjLF" --auth-no-challenge "https://api.bitbucket.org/2.0/repositories/samgooi4189/bitbucket-download-test/src/master/README.md"
--2020-09-02 22:21:57-- https://api.bitbucket.org/2.0/repositories/samgooi4189/bitbucket-download-test/src/master/README.md
Resolving api.bitbucket.org (api.bitbucket.org)... 18.205.93.6, 18.205.93.7, 18.205.93.8, ...
Connecting to api.bitbucket.org (api.bitbucket.org)|18.205.93.6|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2622 (2.6K) [text/plain]
Saving to: ‘README.md’
@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 / synology-transmission-note.txt
Last active November 13, 2021 08:22
Synology transmission change username and password
It is imperitive that you need to change 2 files in order to prevent transmission to overwrite your changes.
The default credential is admin:admin
1. SSH into your synology
2. edit /var/packages/transmission/target/var/settings.json to change the username and password
3. edit /var/packages/transmission/var/settings.json to change the username and password
To understand how the username and password get inserted into the settings.json, you can read /var/packages/transmission/scripts/service-setup
@samgooi4189
samgooi4189 / ruby20210601-command.txt
Last active June 1, 2021 12:59
ruby workshop 20210601 cheat sheet
# clone and cd into your repo
create config/master.key
38e8eded99cab7f153507c62c5093659
# Add non-root user
useradd --create-home --shell /bin/bash deploy
sudo usermod -aG sudo deploy
sudo echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
su deploy
cd
@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
```