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 / node_prune.sh
Created November 24, 2017 02:32 — forked from gpittarelli/node_prune.sh
Prunes very-likely-uneeded files from node_modules directories
#!/usr/bin/env bash
# Port of https://github.com/tj/node-prune to bash
# Also,
# - fixed "*.ts" being overzealous and killing .d.ts files
# - added some more file types from https://github.com/npm/npm/issues/5264#issuecomment-259800486
#
# See also:
# - https://github.com/timoxley/cruft
# - https://yarnpkg.com/en/docs/cli/autoclean
# - https://github.com/ModClean/modclean
@royalgarter
royalgarter / update-dokku-stack.sh
Created June 12, 2018 03:46 — forked from egerlach/update-dokku-stack.sh
Update stack underlying apps running on dokku
#!/bin/bash
# before you can use this, you need to run (as root):
# git clone https://github.com/tt/stack-images.git /root/stack-images
# git clone https://github.com/gliderlabs/herokuish.git /root/herokuish
# First, we need to get our base ubuntu images up to date
docker pull ubuntu-debootstrap:14.04
docker pull ubuntu:trusty # for postgresql
@royalgarter
royalgarter / install-redis.sh
Created December 16, 2018 04:04 — forked from clzola/install-redis.sh
Bash script for installing Redis on Ubuntu 16.04
#!/bin/bash
# Install the Build and Test Dependencies
apt-get update
apt-get install -y curl build-essential tcl
# Download and Extract the Source Code
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz

Running a Full Node

Before you begin you'll need to have about 100GB of disk space available to store the Bitcoin blockchain plus additional database information. Both 64bit Mac OS X and GNU/Linux are currently supported. The process of downloading the blocks and indexing can take upwards of 4 hours, depending on Internet connection and other factors. So it's suggested to plan accordingly and let the node syncronize while you're away. It's also possible to use an existing Bitcoin data directory, which will speed up the process.

Step 1: Install Node.js v0.12

It's recommended to install the Node Version Manager, as this makes it simple to switch between different Node.js versions. We will specifically need to install and run v0.12. Please follow the directions at https://github.com/creationix/nvm#install-script and then run:

nvm install v0.12.7
@royalgarter
royalgarter / setup-zeromq.sh
Created May 12, 2019 06:38 — forked from katopz/setup-zeromq.sh
Setup zeromq in Ubuntu 16.04
#!/usr/bin/bash
# Download zeromq
# Ref http://zeromq.org/intro:get-the-software
wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz
# Unpack tarball package
tar xvzf zeromq-4.2.2.tar.gz
# Install dependency
@royalgarter
royalgarter / lightning node.md
Created May 12, 2019 06:40 — forked from dougvk/lightning node.md
Start a lightning full node

Run the lightningd node on mainnet

root@docker-s-6vcpu-16gb-nyc3-01:~# mkdir -p /scratch/bitcoin/mainnet/clightning
root@docker-s-6vcpu-16gb-nyc3-01:~# docker run --rm --name lightning --network container:bitcoind_mainnet -v /scratch/bitcoin/mainnet/bitcoind:/root/.bitcoin -v /scratch/bitcoin/mainnet/clightning:/root/.lightning --entrypoint /usr/bin/lightningd cdecker/lightningd:master --network=bitcoin --log-level=debug

Check the log output

...
lightningd(1): Hello world from 03e71ed1bbedcf41d97e06ef3dfe4cdf79e871e9a3c809ab32b78e71dea45bf78c aka SLICKERGOPHER #03e71e (version v0.5.2-2016-11-21-1414-g5eceaa7)!
@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
@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 / 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 / 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