Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
condenser=`pacmd list-sources | grep name: | grep -o "<.*Condenser.*>" | awk -F'[<>]' '{print($2)}'`
condenser_default=($condenser) # get first item
pacmd set-default-source $condenser_default
pacmd set-source-volume $condenser_default 0x10000
pacmd unload-module module-echo-cancel 2>&1 > /dev/null
pacmd load-module module-echo-cancel
condenser=`pacmd list-sources | grep name: | grep -o "<.*Condenser.*\.echo-cancel>" | awk -F'[<>]' '{print($2)}'`
pacmd set-default-source $condenser
pacmd set-source-volume $condenser 0x10000
#!/bin/bash
echo 0 | sudo tee /sys/devices/system/cpu/cpufreq/boost
@toryano0820
toryano0820 / wsl2-ubuntu-map-win-localhost.sh
Last active May 11, 2024 03:32
For WSL2: Fixes "Connection Refused" issue when accessing Windows localhost services. Run with "sudo sh wsl2-ubuntu-map-win-localhost.sh" !!! Remember to backup "/etc/hosts" just in case !!!
nameserver=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}') # find nameserver
[ -n "$nameserver" ] || "unable to find nameserver" || exit 1 # exit immediately if nameserver was not found
echo "##### nameserver found: '$nameserver'"
localhost_entry=$(grep -v "127.0.0.1" /etc/hosts | grep "\slocalhost$") # find localhost entry excluding 127.0.0.1
if [ -n "$localhost_entry" ]; then # if localhost entry was found
echo "##### localhost entry found: '$localhost_entry'"
sed -i "s/$localhost_entry/$nameserver localhost/g" /etc/hosts # then update localhost entry with the new $nameserver
else # else if entry was not found
echo "##### localhost entry not found"
echo "$nameserver localhost" >> /etc/hosts # then append $nameserver mapping to localhost
@toryano0820
toryano0820 / ubuntu-install-docker.sh
Last active October 23, 2020 09:02
Install script for docker-ce and docker-compose using instructions at digitalocean.com
#!/bin/bash
# install system prerequisites
sudo apt update
sudo apt install -y software-properties-common apt-transport-https
# install docker-ce
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
@toryano0820
toryano0820 / py3compile.py
Last active November 7, 2020 04:10
Create `.so` package from Python3 package or module.
'''
Create `.so` package from Python3 package or module.
- Put this script outside working directory.
- Compile package: `cd /path/to/src/folder && python3 /path/to/py3compile.py`
- Compile module: `cd /path/to/src/folder && python3 /path/to/py3compile.py FILE1 [FILE2 ...]`
- Output: `/path/to/src/folder_so`
'''
from distutils.core import setup
from distutils import sysconfig