Skip to content

Instantly share code, notes, and snippets.

@ianchen06
ianchen06 / Dockerfile
Last active June 9, 2024 20:11
undetected chrome driver in docker
FROM python:3.11-slim
WORKDIR /app
RUN apt-get update && apt-get install -y curl gnupg && curl -O https://packages.cloud.google.com/apt/doc/apt-key.gpg && apt-key add apt-key.gpg \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B \
&& apt-get update \
&& apt-get install -y google-chrome-stable xvfb xserver-xephyr tigervnc-standalone-server x11-utils gnumeric
COPY requirements.txt .
RUN pip install -r requirements.txt
@ianchen06
ianchen06 / app.py
Created March 24, 2024 19:30 — forked from cquangc/app.py
Streamlit + Firebase authorization example
"""Module for handling authentication, interactions with Firebase and JWT cookies.
This solution is refactored from the ‘streamlit_authenticator’ package . It leverages JSON
Web Token (JWT) cookies to maintain the user’s login state across browser sessions. For the
backend, It uses Google’s Firebase Admin Python SDK. This solution ensures that the content
of the page and user settings panel are only displayed if the user is authenticated. Similarly,
the login page can only be accessed if the user is not authenticated. Upon registration, the
user is sent a verification link to their e-mail address.
Important - to make this app run, put the following variables in your secrets.toml file:
COOKIE_KEY - a random string key for your passwordless reauthentication
@ianchen06
ianchen06 / cap.sh
Created November 6, 2023 22:23 — forked from patillacode/cap.sh
#!/bin/bash
################################################################################
# cap - capture your screen
#
# This script allows you to capture your screen on Linux or macOS systems using
# the appropriate tools available on each platform. On Linux, it uses 'slop'
# and 'ffmpeg', while on macOS, it utilizes 'screencapture'. The script prompts
# you to select a desktop area for recording and saves the recording as an MP4/MOV
# file with customizable video quality.
@ianchen06
ianchen06 / .config
Created September 26, 2021 08:46 — forked from petejohanson/.config
Zaphod config
#
# ZMK
#
#
# Basic Keyboard Setup
#
CONFIG_ZMK_KEYBOARD_NAME="Zaphod"
CONFIG_USB_DEVICE_PRODUCT="Zaphod"
@ianchen06
ianchen06 / drone_docker_mono.sh
Created December 10, 2019 22:11
Execute only when specified module is changed
git diff-tree --no-commit-id --name-only -r `git rev-parse master` | awk -F "/" '{print $1}' | uniq |
grep mysql2hive && /usr/local/bin/dockerd-entrypoint.sh /bin/drone-docker
@ianchen06
ianchen06 / install_python.sh
Created August 20, 2019 05:02
How to install Python 3 on Mac OS 10.14 and later
brew install openssl readline sqlite3 xz zlib
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
curl https://pyenv.run | bash
@ianchen06
ianchen06 / install_nginx_ingress.sh
Created August 8, 2019 22:40
Install nginx ingress with nodeport
helm upgrade --install --set controller.service.type=NodePort --set controller.service.nodePorts.http=32080 --set controller.service.nodePorts.https=32443 nginx-ingress stable/nginx-ingress
@ianchen06
ianchen06 / change_kubeapi_san.sh
Created August 6, 2019 01:55
Change kube apiserver cert SAN with cluster bootstrapped with kubeadm
kubeadm config view > /root/kubeadmconf.yml
kubeadm config upload from-file --config /root/kubeadmconf.yml
cd /etc/kubernetes/pki
# check cert before
openssl x509 -in apiserver.crt -text -noout
rm apiserver.*
kubeadm init phase certs apiserver --config=/root/kubeadmconf.yml
# check cert after
openssl x509 -in apiserver.crt -text -noout
systemctl daemon-reload
@ianchen06
ianchen06 / capless_monitor.sh
Created May 22, 2019 22:04
Cheap capless monitor on kingdomnote
curl -s https://search.kingdomnote.com/\?limit\=20\&order\=priceAsc\&keyword\=%E3%82%AD%E3%83%A3%E3%83%83%E3%83%97%E3%83%AC%E3%82%B9%20PILOT\#itemlist | python3 -c 'import sys, re; s = sys.stdin.read(); res = [int(x.replace(",","")) for x in re.findall("""FP-resultItem__price">¥(.+?)<""", s)]; print(res);'