Skip to content

Instantly share code, notes, and snippets.

View sarkrui's full-sized avatar
🚀
Kicking off

Sark sarkrui

🚀
Kicking off
View GitHub Profile
@sarkrui
sarkrui / install.sh
Created May 30, 2023 03:53
Deploy Amazon Price Tracker
# Installing dependencies
DEBIAN_FRONTEND=noninteractive && \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub > /usr/share/keyrings/chrome.pub && \
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/chrome.pub] http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/google-chrome.list && \
apt update -y && \
apt install -y google-chrome-stable
apt install xvfb -y
# Install miniconda
DEBIAN_FRONTEND=noninteractive && \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub > /usr/share/keyrings/chrome.pub && \
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/chrome.pub] http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/google-chrome.list && \
apt update -y && \
apt install -y google-chrome-stable
apt install xvfb -y
export DISPLAY=:1
@sarkrui
sarkrui / config
Created May 29, 2023 13:49
SSH Config
Host *
ConnectTimeout 30
ServerAliveInterval 30
ControlMaster auto
ControlPersist 60s
HashKnownHosts yes
GSSAPIAuthentication no
IdentitiesOnly yes
Compression yes
Host usny
@sarkrui
sarkrui / update_headscale.sh
Created May 17, 2023 06:50
Update headscale to the latest for Linux AMD64
#!/bin/bash
# Set the destination directory
DEST_DIR="/usr/local/bin"
# Get the latest release tag from the GitHub API
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/juanfont/headscale/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
# Form the URL of the latest release binary for Linux AMD64
ASSET_URL="https://github.com/juanfont/headscale/releases/download/${LATEST_RELEASE}/headscale_${LATEST_RELEASE#v}_linux_amd64"
@sarkrui
sarkrui / cloudflared
Created February 11, 2023 05:14
Cloudflared OpenRC on Alpine
#!/sbin/openrc-run
name=cloudflared
command="/usr/bin/$name"
command_args="tunnel --config /etc/cloudflared/config.yml run"
command_background="yes"
start_stop_daemon_args="--user root:root"
pidfile="/run/$name.pid"
@sarkrui
sarkrui / nginx.conf
Last active January 3, 2023 08:29
Enable public visit for better bibtex plugin on Mac
server
{
listen 80;
listen 443 ssl http2;
server_name [YOUR_DOMAIN];
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/zotero;
#SSL-START SSL related configuration, do NOT delete or modify the next line of commented-out 404 rules
#error_page 404/404.html;
@sarkrui
sarkrui / ssh-config.md
Created December 29, 2022 09:07
SSH Config Template for Linux/Mac

SSH Config Template

Host *
     ConnectTimeout 30
     ServerAliveInterval 30
     ControlMaster auto
     ControlPersist 60s
     HashKnownHosts yes
 GSSAPIAuthentication no
@sarkrui
sarkrui / 10GbE Ethernet Cards for Macs.md
Last active December 29, 2022 10:24
10GbE Ethernet Cards for Macs

Some key takeways

The M1 Mac natively supports AQC107s and AQC113 (tested and effective)/AQC113CS core models. AQC107 has been tested and is not supported (macOS 12/13).

Where to buy

The AQC113 can be found on PChome in Taiwan. The OWC 10G Ethernet PCIe Network Adapter Expansion Card can be purchased for 108USD. The AQC113 PCIe3.0 x1 adapter for Thunderbolt 3 has a reading speed of 10GbE on a Mac (Ventura 13.1).

@sarkrui
sarkrui / Rathole macOS Launchctl Plist.md
Last active December 28, 2022 07:13
Rathole macOS Launchctl Plist

Run Installation Script

sh -c "$(curl -fsSL https://gist.githubusercontent.com/sarkrui/ae2dcd9698665c92387336fca3b9cd65/raw/a6b00b901b8d1ef8a6b83178aff4aa38ca97c8d9/install.sh"
@sarkrui
sarkrui / bibtex-export.md
Last active December 16, 2022 09:27
Automator Application to Export References as Bib file for Overleaf

Demo

Please use Better BibTeX for Zotero to generate the URLs of your literature collections.

AppleScript

on run {input, parameters}