Skip to content

Instantly share code, notes, and snippets.

@n00bsys0p
n00bsys0p / gist:224e74b06f3f4eefac13c4ef43f43cc2
Created November 19, 2017 02:57
BlockStack verification
Verifying my Blockstack ID is secured with the address 1FGnPy8UmJF4XtJHKLGX2RYgHTgKB4QNk2 https://explorer.blockstack.org/address/1FGnPy8UmJF4XtJHKLGX2RYgHTgKB4QNk2
@n00bsys0p
n00bsys0p / nhz.sh
Created November 10, 2014 09:16
NHZ Node Restart Script
#!/bin/bash
SCREEN="screen -d -m -S"
USER="nhz_user"
SUDO="sudo -u $USER"
HOME="/home/$USER"
LOGFILE="/var/log/nhz-check.log"
if ! [[ $(ps aux | egrep "[S]CREEN.*NHZ_NODE") ]]; then
echo "Restarting NHZ node at $(date)" >> $LOGFILE
PUB_DIR="$HOME/nhz-pub"
@n00bsys0p
n00bsys0p / Altcoins_nBitsToDiff.php
Created June 12, 2014 21:07
A quick, easily portable PHP script to convert nBits to an actual diff.
<?php
// Try this with 1d00ffff for a diff of 1 (original Bitcoin mainnet and testnet)
// or 207fffff for 4.6565423739069E-10 (Bitcoin regtest network)
function ConvertBitsToDouble($nBits){
$nShift = ($nBits >> 24) & 0xff;
$dDiff =
(double)0x0000ffff / (double)($nBits & 0x00ffffff);
@n00bsys0p
n00bsys0p / gendepends.sh
Last active August 29, 2015 13:58
Generates a list of installed packages that are required to go in the "Depends" section of a debian package for a single binary.
#!/bin/bash
# Pass this program the relative or full path to a binary to parse with `ldd`
PROGRAM=$1
LDD_FILES=$(ldd "$1" | awk '{print $3}' | sed '/^$/d' | egrep -v "^\(0x.*\)")
for FILE in $LDD_FILES
do
@n00bsys0p
n00bsys0p / l4.sh
Created June 24, 2013 16:07
This script will grab a copy of Laravel 4, install all packages, and configure Git. Run the script with no parameters for usage information.
#!/bin/bash
GIT=$(which git)
PHP=$(which php)
CURL=$(which curl)
COMPOSERURL="https://getcomposer.org/installer"
THIS="$0"
MODE="$1"
@n00bsys0p
n00bsys0p / sqlpipe.sh
Last active December 18, 2015 03:48
This script will pipe a database dump, with optional restricted tables across SSH to a MySQL server on a remote host. It uses bzip2 encryption to speed up the transfer. Should be easy enough to use xz instead, but for legacy compatibility I've used bzip2. Should work with any two systems which have bzip2 >= 0.9. This can be used to import a mast…
#!/bin/bash
# Parameters
LSQLUSER="local_sql_user"
LSQLPW="local_sql_password"
DBNAME="db_name"
TABLELIST="example users sessions posts migrations" # For all tables, set to empty
ROSUSER="remote_os_user"
RHOST="remote-host.tld"
RSQLUSER="remote_sql_user"
#!/bin/bash
ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS
echo "x" > /sys/bus/scsi/devices/[n]:0:0:0/delete
echo "0 0 0" >/sys/class/scsi_host/host[n]/scan
@n00bsys0p
n00bsys0p / listpackagesbysize.sh
Created September 26, 2012 13:49
List all Slackware packages by size, ignoring less than 1MB
#!/bin/bash
/usr/bin/grep UNCOMPRESSED /var/log/packages/* | awk -F: '{print $3,$1}' | sort -rn | egrep '^\s*[0-9]+\.?[0-9]+M'