Skip to content

Instantly share code, notes, and snippets.

@seakintruth
seakintruth / hb_all_books_dl.js
Last active December 1, 2017 06:02 — forked from kfatehi/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
this fork downloads all formats and does so without using jquery (since that didnt work for me)
note that if you are in chrome, chrome will not download the pdfs for you by default, to fix this
Settings (chrome://settings) --> Advanced --> Privacy and security --> Content settings --> PDF documents --> Download PDF files instead of automatically opening them in Chrome --> Turn ON
Settings (chrome://settings) --> Advanced --> Downloads --> Ask where to save each file before downloading --> Turn OFF
*/
@seakintruth
seakintruth / library.packages.R
Last active August 9, 2020 19:19
Function that installs and librarys as many packages as you want in one sweep
# Modified from https://github.com/plynty/bls-ce-r-tools/blob/master/CE_PUMD_Wrangler.R
# Function that installs and librarys as many packages as you want in one sweep
# This action is similar to the utils::install.packages function
# just simplified/custom for my needs
# Parameters: string of package(s) name(s)
# fOnlyEnsureInstalled if TRUE does not load packages...
# Usage: library.packages("data.table","dplyr","stringr","dtplyr")
# Returns a matrix of packages and status of install and load/attachment
library.packages <- function(
...,
@seakintruth
seakintruth / RSTUDIO_Version_Launcher.sh
Last active October 17, 2021 21:11
Rstudio Version Launcher (And R Version installer) for Ubuntu / Debian.
#!/usr/bin/env bash
# failed to perform conditional arithmatic when using #!/bin/sh
# Made available under (CC BY-SA 3.0) https://creativecommons.org/licenses/by-sa/3.0/
# The menu system as modified from https://askubuntu.com/a/257766/957393
# The option_picked function is by Jeremy D. Gerdes seakintruth@gmail.com April 2019
# The install_if_missing is modified from https://stackoverflow.com/a/22592801/1146659
# -------------------------------------------------------------------------------------
# Before running this script Install R and Rstudio with/from:
# sudo apt install r-base
# https://rstudio.com/products/rstudio/download/#download
@seakintruth
seakintruth / afkCobblestoneGenerator.sh
Last active April 12, 2020 01:06
Minecraft java linux script for AFK cobblestone generator --- Depends: xdotool
#!/usr/bin/env bash
echo "afkCobblestoneGenerator.sh::Run the most recent version with either of:"
echo "bash <(curl -s https://gist.githubusercontent.com/seakintruth/7610cac5df7bfd1c9acc13794a01c59a/raw)"
echo "bash <(wget -q -O - https://gist.githubusercontent.com/seakintruth/7610cac5df7bfd1c9acc13794a01c59a/raw)"
install_if_missing() {
# https://stackoverflow.com/a/22592801/1146659
local package_name=$1
if [ $(dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo -n "Attempt to install package $package_name? [yes or no]: "
@seakintruth
seakintruth / afkZombieXpFarm.sh
Last active April 12, 2020 01:08
Minecraft java linux script for AFK zombie xp farm --- Depends: xdotool
#!/usr/bin/env bash
echo "afkZombieXpFarm.sh::Run the most recent version with"
echo "bash <(curl https://gist.githubusercontent.com/seakintruth/27c93bf174c2cc25131932be34e32fa3/raw)"
echo "bash <(wget -q -O - https://gist.githubusercontent.com/seakintruth/27c93bf174c2cc25131932be34e32fa3/raw)"
echo "clicking: $1"
echo [ -z "$*" ]
date1=$((`date +%s`));
i=0;
# Building functions per https://tldp.org/LDP/abs/html/complexfunct.html
#!/usr/bin/env bash
sudo -s apt-get update
sudo -s apt-get upgrade -y
launcherUrl="https://launcher.mojang.com/download/Minecraft.deb"
fLauncher="$(mktemp /tmp/myscript.XXXXXX)"
echo "Downloading minecraft.deb to tempfile $fLauncher ..."
wget -P $fLauncher $launcherUrl
sudo -s apt-get install $fLauncher
echo "Deleting tempfile $fLuancher ..."
@seakintruth
seakintruth / runServer.sh
Last active April 5, 2020 17:27
Run minecraft server, restart every 10 minutes if java isn't running
#!/usr/bin/env bash
while true
do
if pgrep -x java >/dev/null
then
echo "Java is running, assuming minecraft is running: $(date)"
else
echo "Java not running, Starting minecraft server... $(date)"
# screen doesn't allways cleanup properly
@seakintruth
seakintruth / func_TimeStampEpoch.bas
Last active February 26, 2021 20:45
Visual Basic Epoch Time Handling
'Notes: Visual Basic (VBScript, or VBA) to handle UNIX like Epoch Timestamps with timezone corrections to UTC
' TimeStampEpoch, and date2epoch functions return epoch as fracional decimal values in seconds since epoch
'Maintained at:https://gist.github.com/seakintruth/ddcc3d5e400a5083458494ae30d55466
'Dependencies: Windows with "WbemScripting.SWbemDateTime", a default 32bit app
'Contributing: Jeremy D. Gerdes<seakintruth@gmail.com>, https://stackoverflow.com/a/22842128
'License: CC-BY-SA 3.0
'Version: 1.0.6
Function TimeStampEpoch()
'Returns a time stamp in the format of seconds since epoch
' Use this when you need epoch values, from testing, calling Timer() is roughly 10 times faster than calling TimeStampEpoch
def extractDomain(data):
# Remove protocol part of url
data = re.sub(r"^http(s)?\x3a\x2f\x2f", "", str(data), flags=re.IGNORECASE)
# Remove part after FQDN
data = re.sub(r"\x2f(.*)$", "", str(data), flags=re.IGNORECASE)
# Remove port
data = re.sub(r"\x3a\d{1,}$", "", str(data), flags=re.IGNORECASE)
@seakintruth
seakintruth / get_pretty_timestamp_diff.R
Created May 27, 2021 02:45
Get a pretty display from two timestamps (diff of seconds)
get_pretty_timestamp_diff <- function(
start_timestamp,
end_timestamp,
seconds_decimal=2,
round_simple=TRUE
){
# Set defaults
.days_decimal <- 0
.days <- 0
.hours_decimal <- 0