This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set logfile=%computername%.log.txt | |
set maxlines=1024 | |
set /a taillines=%maxlines%-1 | |
cd %~dp0 | |
powershell -command "Get-Content %logfile% -Tail %taillines%" 1> tmp.txt 2> nul | |
type tmp.txt > %logfile% | |
echo %date% %time% >> %logfile% | |
del tmp.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* const expected = [[0, 2], [1, 3]] | |
* const actual = [...zip([0, 1], [2, 3])] | |
* assert JSON.stringify(expected) === JSON.stringify(actual) | |
*/ | |
export function *zip(...arrays) { | |
try { | |
arrays[0] = [...arrays[0]] | |
} catch { | |
throw Error(`TypeError: First argument "${arrays[0]}" is not iterable`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git diff > ~/tmp/wip.patch | |
patch -p1 < ~/tmp/wip.patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat << EOF > ~/.gitignore_global | |
.DS_Store | |
.venv/ | |
tmp/ | |
EOF | |
git config --global core.excludesfile ~/.gitignore_global |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat $PATH_TO_TARGET | python -c "import sys; import hashlib; print(hashlib.sha256(sys.stdin.buffer.read()).hexdigest())" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ! command -v python3 &> /dev/null; then | |
sudo amazon-linux-extras install -y python3.8 | |
if ! command -v pip3 &> /dev/null; then | |
pip=`which pip3.8` | |
sudo ln -s $pip `dirname $pip`/pip3 | |
fi | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2... | |
# This also works perfectly for all static file content in all projects | |
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config. | |
# Example: | |
# http://example.com - Main Laravel site as usual | |
# http://example.com/about - Main Laravel site about page as usual | |
# http://example.com/robots.txt - Main Laravel site static content as usual | |
# http://example.com/api/v1 - Lumen v1 api default / route | |
# http://example.com/api/v1/ - Lumen v1 api default / route |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################## | |
# Host your own Rust Dedicated Server | |
# | |
# see also: https://www.rustafied.com/how-to-host-your-own-rust-server | |
# | |
# Usage: | |
# RUST_HOME=$HOME/rust \ | |
# RUST_SERVER_MAXPLAYERS=100 \ | |
# RUST_SERVER_HOSTNAME="Your Rust Server" \ | |
# RUST_SERVER_IDENTITY=your-rust-server \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version=12.4 # ref: https://ftp.postgresql.org/pub/source/ | |
sudo yum groupinstall "Development Tools" -y | |
sudo yum install readline readline-devel -y | |
wget -O - https://ftp.postgresql.org/pub/source/v$version/postgresql-$version.tar.bz2 | tar jxf - | |
cd postgresql-$version | |
# ref: https://www.postgresql.org/docs/12/install-short.html | |
./configure | |
make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -z "$CLIENT_IP_ADDR" ]; then | |
echo '$CLIENT_IP_ADDR is required' | |
exit 1 | |
fi | |
sudo yum install squid -y | |
sudo systemctl enable squid | |
sudo sh -c "cat << 'EOF' > /etc/squid/squid.conf | |
# ACL My IP address | |
acl client_ip_addr src $CLIENT_IP_ADDR/32 |