Skip to content

Instantly share code, notes, and snippets.

View cmdruid's full-sized avatar
💭
Looking to contribute

cmd cmdruid

💭
Looking to contribute
  • Freelance
  • Austin, TX
  • 22:47 (UTC -06:00)
View GitHub Profile
@cmdruid
cmdruid / config.yml
Last active November 23, 2022 21:11
This is my Ruby DNS Updater script. If you are using an .htaccess file to forward a domain or subdomain to your server's dynamic IP address, this script will make sure that .htaccess file stays updated with your server's current address. This script is an alternative to using services like Dynamic DNS or No-IP. This script uses SFTP and the 'net…
# This is my Ruby DNS Updater script. If you are using an .htaccess
# file to forward a domain or subdomain to your server's dynamic IP
# address, this script will make sure that file stays updated with
# your server's current address. This script is an alternative to
# using services like Dynamic DNS.
# This script uses SFTP and the 'net-sftp' gem to connect to your
# hosting via a secure connection. You must add all your relevant
# information below in order for this script to work.
@cmdruid
cmdruid / README.md
Created April 2, 2020 09:46
SCRIPT-8
@cmdruid
cmdruid / lfsr.js
Created October 2, 2020 22:40
Javascript implementation of a LFSR function using bitwise operators.
export default function LFSR(len, seed, mask=0x80000057) {
/** == Linear Feedback Shift Register ==
* Javascript implementation of a LFSR function using bitwise operators.
* Default mask uses optimal XOR taps for a 32-bit integer, which is the
* limit for bitwise operations in javascript.
*
*
* @param {Number} [length] : Length of number in bytes.
* @param {Number} [seed] : The starting seed for the shift register.
* @param {Number} [mask] : Mask to use for mapping XOR taps. Default is 0x80000057,
@cmdruid
cmdruid / init.vim
Last active November 9, 2020 00:56
Configuration file for Nvim
" [Install Nvim]
" wget --quiet https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage --output-document nvim
" [Set permissions and move to bin folder]
" chmod +x nvim && sudo chown root:root nvim && sudo mv nvim /usr/bin
" [Create user config folder]
" touch -p ~/.config/nvim/init.vim
" [Install optional Python module]
@cmdruid
cmdruid / post-gist.py
Created November 12, 2020 19:10
Upload file to gist from command line.
#! /usr/bin/env python3
from pathlib import Path
import argparse, requests, json
def postGist(filename, tokenfile, desc='', public=False):
""" Post a file to Github as a gist. """
content = Path(filename).read_text()
token = Path(tokenfile).read_text().replace('\n', '')
url = 'https://api.github.com/gists'
#! /usr/bin/env python3
import argparse, csv, json, os, re, sys, importlib.util
from datetime import datetime
class csvTool:
def __init__(self, filename, limit=0, script=None, query=None):
self.cwd = os.getcwd()
self.name = filename.split('.')[0]
@cmdruid
cmdruid / rpcauth.sh
Last active April 21, 2022 03:09
POSIX compliant script for generating Bitcoin RPC credentials.
#!/bin/sh
## POSIX compliant script for generating Bitcoin RPC credentials.
## Requires xxd and openssl packages to be installed.
## Distributed under the MIT software license.
###############################################################################
# Environment
###############################################################################
RPCAUTH_USER="bitcoin"
@cmdruid
cmdruid / lndconnect_sample.sh
Created April 18, 2022 05:12
Format credentials as lndconnect URL and generate QR code.
#!/bin/sh
## Format credentials as lndconnect URL and generate QR code.
## Requires qrencode package.
HOST_ADDR="ADDRESS:PORT"
HOST_CERT=`cat /path/to/certificate.pem | sed '1d;$d' | tr -d '=' | tr '/+' '_-' | tr -d '\n'`
MACAROON=`base64 /path/to/access.macaroon | tr -d '=' | tr '/+' '_-' | tr -d '\n'`
echo "lndconnect://$HOST_ADDR?cert=$HOST_CERT&macaroon=$MACAROON" | qrencode -o /path/to/save/qrcode.png
@cmdruid
cmdruid / onionport.sh
Created April 18, 2022 07:05
Forward traffic from a local port to an onion address.
#!/bin/sh
## Bind a local port and forward its traffic to an onion address.
## Requires socat to be installed, and a tor proxy to be running.
###############################################################################
# Environment
###############################################################################
SOCKS_HOST="127.0.0.1"
SOCKS_PORT="9050"
@cmdruid
cmdruid / jgrep.sh
Last active May 2, 2022 04:59
Simple script that extracts the value for a given key within a JSON output.
#!/bin/sh
## Takes an input pipe of JSON, and outputs the value for a given key.
set -e
usage() {
printf "
Takes an input pipe of JSON, and outputs the value for a given key. \n
Usage: some_JSON_output | jgrep key \n
"