Skip to content

Instantly share code, notes, and snippets.

@luminoso
luminoso / script.sh
Created October 27, 2022 08:08
bash script template
#!/usr/bin/env bash
# template source: https://news.ycombinator.com/item?id=33352967
set -o errexit
set -o nounset
set -o pipefail
if [[ -n "${TRACE-}" ]]; then
set -o xtrace
fi
@luminoso
luminoso / exportSpreadsheet.gs
Created October 29, 2021 13:12 — forked from Spencer-Easton/exportSpreadsheet.gs
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@luminoso
luminoso / kubectx_zinit.sh
Created April 21, 2021 08:37
kubectx zinit install
git clone https://github.com/ahmetb/kubectx.git
cd kubectx
#COMPDIR=$(pkg-config --variable=completionsdir bash-completion)
COMPDIR=$HOME/.zinit/completions
ln -s $(pwd)/completion/kubectx.zsh $COMPDIR/_kubectx.zsh
ln -s $(pwd)/completion/kubens.zsh $COMPDIR/_kubens.zsh
cd cmd/kubect
go build
@luminoso
luminoso / borg.txt
Last active October 26, 2023 17:02
Borg exclusion list
*/CachedData
*/CacheStorage
*/.cargo
*/.ccache
*/.[Cc]ache
*/[Cc]ache
*/.conda
*/.config/BraveSoftware/Brave-Browser-Beta
*/.config/BraveSoftware/Brave-Browser-Nightly
*/.config/Code/logs
./i2pd --log stdout \
--loglevel info \
--port 20750 \
--host $(curl -s https://api.ipify.org) \
--nat 0 \
--floodfill \
--bandwidth X \
--limits.openfiles 8192 \
--limits.transittunnels 2500 \
--limits.ntcpsoft 192 \
@luminoso
luminoso / .zshrc
Created October 14, 2020 15:50
zinit zshrc
### Added by Zinit's installer
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then
print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f"
command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit"
command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \
print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \
print -P "%F{160}▓▒░ The clone has failed.%f%b"
fi
@luminoso
luminoso / mtg.service
Last active January 10, 2021 10:18
[mtg.service] #mtg #systemd #proxy #service
[Unit]
Description=mtproxy
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
ExecStart=/opt/mtg run -v -w 128KB -r 128KB --prefer-ip ipv6 --cloak-port 993 -b 0.0.0.0:443 ee5c557d37ddde51c21d4577a29b88bbcc6d747072782e6e6f772e696d
AmbientCapabilities=CAP_NET_BIND_SERVICE
Restart=never
@luminoso
luminoso / Dockerfile
Last active June 4, 2020 15:00
Docker jupyterlab under condas
FROM ubuntu:20.04
#
# 1. Hadoop
#
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq update && apt-get -qq -y install openjdk-14-jdk-headless wget build-essential krb5-user\
&& rm -rf /var/lib/apt/lists/* /var/log/dpkg.log
@luminoso
luminoso / example.service
Created May 30, 2020 21:37
systemd unit sample
$ cat /etc/systemd/system/example.service
[Unit]
Description=basic service
[Service]
Type=notify
ExecStart=/bin/bash /usr/bin/true
Restart=on-failure
NoNewPrivileges=yes
@luminoso
luminoso / socat_to_namespace.sh
Last active October 31, 2022 20:27
socat to a network namespace
#https://unix.stackexchange.com/a/298409
sudo socat tcp-listen:500,fork,reuseaddr \
exec:'ip netns exec vpn socat STDIO "tcp-connect:127.0.0.1:5000"',nofork