Skip to content

Instantly share code, notes, and snippets.

View royalgarter's full-sized avatar

Tom (Tung Pham Thanh) royalgarter

View GitHub Profile
@royalgarter
royalgarter / web-servers.md
Created January 24, 2024 10:31 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@royalgarter
royalgarter / install_docker_in_colab.sh
Created July 12, 2023 14:34 — forked from mwufi/install_docker_in_colab.sh
Install Docker in Google Colab!
# First let's update all the packages to the latest ones with the following command
sudo apt update -qq
# Now we want to install some prerequisite packages which will let us use HTTPS over apt
sudo apt install apt-transport-https ca-certificates curl software-properties-common -qq
# After that we will add the GPG key for the official Docker repository to the system
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# We will add the Docker repository to our APT sources
@royalgarter
royalgarter / .nanorc
Created June 27, 2023 05:16 — forked from ShyftXero/.nanorc
A good nanorc file
# Options
set tabsize 4
set tabstospaces
set indicator # side-bar for indicating cur position
set linenumbers
#set numbercolor green,normal
#set suspendable # allow nano be suspended
set smarthome # home jumps to line start first
set zap # delete selected text as a whole
@royalgarter
royalgarter / Dockerfile
Created April 29, 2023 16:44 — forked from cilf/Dockerfile
Adminer MongoDB docker image
FROM adminer:4.7.1
# WATCH OUT WHEN UPGRADING, THE SED BELOW MIGHT STOP WORKING
MAINTAINER marek@cilf.cz
USER root
RUN apk add autoconf gcc g++ make libffi-dev openssl-dev
RUN pecl install mongodb
RUN echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini
@royalgarter
royalgarter / job.yaml
Created March 15, 2023 16:33 — forked from alexellis/job.yaml
Use a Kubernetes Job and Kaniko to build an OpenFaaS function from Git
# Alex Ellis 2018
# Example from: https://blog.alexellis.io/quick-look-at-google-kaniko/
# Pre-steps:
# kubectl create secret generic docker-config --from-file $HOME/.docker/config.json
# Other potential optimizations (suggested by @errordeveloper)
# - Store "templates" in a permanent volume
# - Download source via "tar" instead of git clone
@royalgarter
royalgarter / s3.sh
Created March 1, 2022 15:02 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@royalgarter
royalgarter / embedded-file-viewer.md
Created November 2, 2021 16:46 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@royalgarter
royalgarter / AuthyToBitwarden.md
Created May 4, 2021 03:25
Export TOTP from Authy to Bitwarden

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes (beware, through Google) for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My gues

@royalgarter
royalgarter / clean.sh
Created November 7, 2020 03:35 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@royalgarter
royalgarter / lnd.service
Created May 23, 2019 13:53 — forked from mariodian/lnd.service
LND Systemd script
[Unit]
Description=LND Lightning Daemon
Requires=bitcoind.service
After=bitcoind.service
[Service]
ExecStart=/home/satoshi/go/bin/lnd
ExecStop=/home/satoshi/go/bin/lncli stop
PIDFile=/home/satoshi/.lnd/lnd.pid