Skip to content

Instantly share code, notes, and snippets.

dvdbng / copy-aws-eb-env-vars.js
Created Jun 16, 2021
Copy/paste all ENV variables from one AWS beanstalk env to another
View copy-aws-eb-env-vars.js
// Copy/paste all ENV variables from one AWS beanstalk env to another. Use this functions in the browser console
// Copy ENV as json
document.querySelectorAll('.env-props-table tbody tr:not(.ng-hide)')
).map(e => [
dvdbng /
Last active Nov 3, 2020
Change invest private API

Disclammer: This is a private API that the app uses. Do not use it. I'm not responsible for whatever happens if you use it. I'm not associated with Change Invest


user-agent: Change Invest/10.9.80
content-type: application/x-www-form-urlencoded; charset=utf-8
accept-encoding: gzip
content-length: 90
dvdbng / ssh_proxy.js
Created May 12, 2020
TCP forwarding proxy over ssh
View ssh_proxy.js
const net = require('net');
const child_process = require('child_process');
function makeProxy(port, jump, target) {
const server = net.createServer(socket => {
const subprocess = child_process.spawn(
[jump, '-W', target],
{ stdio: ['pipe', 'pipe', 'inherit'] }
dvdbng / gsubrb
Created Apr 10, 2020
Recursive replace in directory, replacement is dynamically created by ruby code
View gsubrb
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'optparse'
require 'active_support/all'
options = {} do |opts|
opts.banner = 'Usage: gsubrb [options]'
opts.on('-r', '--replace [CODE]', String, 'Block that will be executed for each match') do |code|
dvdbng / awsenv
Created Apr 2, 2020
Set AWS credentials from pass store
View awsenv
# Usage awsenv enviromnent command...
file=$(find "$HOME"/.password-store/AWS | grep "$search.*/AKIA.*gpg$")
if [[ x"$file" = x ]]; then
echo "Could not find a AWS key at $search" >&2
exit 1
View eth-balance
# Usage: ./eth-balance address
wei="$(curl -s"$1" | jq .balance)"
eth="$(echo "$wei / (10 ^ 18)" | bc -l)"
echo $eth
View btc-balance
# Usage: ./btc-balance address
btc="$(echo "$satoshis/100000000" | bc -l)"
echo $btc
View correct-horse-battery-staple
cat /etc/dictionaries-common/words | grep -P '^[a-z]{1,10}$' | shuf -n 4 | tr '\n' '-' | sed 's/-$/\n/'
dvdbng /
Created Nov 15, 2019
Convert chinese subtitle to chinese + pinyin (Output is like this: 最zùi高gāo法fǎ院yuàn在zài今jīn天tiān早zǎo上shàng)
import sys
import re
import pysrt
import pinyin
def to_pinyin(text):
pinyins = pinyin.get(text, delimiter=" ").split(' ')
dvdbng /
Created Nov 15, 2019
Merge two or more subtitles
LPT: If your original subtitles are not .srt, convert them using ffmpeg
import sys
import pysrt
def merge_subtitles(srts):