Skip to content

Instantly share code, notes, and snippets.

View jamestomasino's full-sized avatar
🎯
Focusing

James Tomasino jamestomasino

🎯
Focusing
View GitHub Profile
@jamestomasino
jamestomasino / cygwinbackup.sh
Last active September 26, 2023 14:02
Cygwin Package Configuration Backup & Batch Installer
#!/bin/sh
# Builds a batch file that will run a Cygwin installer with the same packages currently installed
# on this system. Think of it as a package-list backup.
echo -n "setup-x86_64.exe -P " > update.bat
cygcheck -c -d | sed -e "1,2d" -e 's/ .*$//' | awk 'NR==1{printf $1}{printf ",%s", $1}' >> update.bat
@jamestomasino
jamestomasino / GoogleMapDivider.php
Last active June 3, 2022 20:48
PHP file to divide up a large image into Google Map tiles
<?php
//Larger images can require more memory and time
ini_set('memory_limit','2048M');
ini_set('max_execution_time','300');
//For testing purposes, I manually entered the input file name and destination folder
$destinationDir = 'tiles/';
$fileName = 'map.jpg';
if (!file_exists($destinationDir)) {
@jamestomasino
jamestomasino / sdf-update-gopher
Created April 29, 2018 18:29
Update script to mirror my gopher repo on SDF, updating relative links
#!/usr/bin/env bash
# Config
GOPHER_DIR="/ftp/pub/users/tomasino/"
GOPHERMAP="${GOPHER_DIR}/gophermap"
# Overrides
pushd () {
command pushd "$@" > /dev/null
}
@jamestomasino
jamestomasino / index.php
Created September 26, 2020 13:10
Tomasino.is homepage
<?php
$article = "";
$path = explode('/', $_SERVER['REQUEST_URI'])[1];
$path2 = explode('/', $_SERVER['REQUEST_URI'])[2];
if (! $path) {
$path = shell_exec("shuf -n1 /usr/share/dictd/gcide.index | cut -f1 ");
}
if (($path === "a") || ($path === "an") || ($path === "the")) {
if (isset($path2)) {
@jamestomasino
jamestomasino / center.awk
Last active May 13, 2022 23:54
center a file of text visually in the terminal (for ascii art)
#!/usr/bin/awk -f
BEGIN {
"tput cols" | getline c
while(getline < ARGV[1])
{
if(length>l){l=length}
}
w=(c-l)/2
}
A. W. Tozer - The Knowledge of the Holy (1961)
Abir Mukherjee - A Rising Man (2017)
Adele Abbott - Witch is When it All Began (2015)
Adrian Tchaikovsky - Children of Ruin (2019)
Adrian Tchaikovsky - Children of Time (2015)
Agatha Christie - And Then There Were None
Agatha Christie - Miss Marple 01 - Murder at the Vicarage
Agatha Christie - Miss Marple 03 - The Moving Finger
Agatha Christie - Miss Marple 04 - A Murder is Announced
Agatha Christie - Miss Marple 05 - They Do it With Mirrors
@jamestomasino
jamestomasino / bashrc.insults
Created March 22, 2019 16:03
bash insult on error
# source this as part of your bash startup scripts
suicidePostCommand() {
if [ $? -ne 0 ]; then
local INSULT
INSULT[0]="Just what do you think you're doing Dave?"
INSULT[1]="It can only be attributed to human error."
INSULT[2]="That's something I cannot allow to happen."
INSULT[3]="My mind is going. I can feel it."
INSULT[4]="Sorry about this, I know it's a bit silly."
#!/usr/bin/env bash
# credentials for stream
TILDE_USER=""
TILDE_PASS=""
# don't return a * if no files found in glob
shopt -s nullglob
# change to directory where script is and run everything there
@jamestomasino
jamestomasino / digitalocean-config.md
Last active September 22, 2020 16:14
Digital Ocean Droplet setup for Nuxt Blue/Green deploys

Setting up a new digital ocean droplet

  • Create droplet with Ubuntu using special digitalocean key for root access.
  • SSH as root with digitalocean key
  • update and upgrade everything in apt

Setting up user and permissions

  • create 'web' user
  • use strong password
@jamestomasino
jamestomasino / 1 - Startup
Last active July 19, 2018 07:25
Setup for OSX development environment
- Install XCode
- Make your user an admin
- Create SSH keys
$ ssh-keygen
- Upload public key to Assembla & Github
$ cat ~/.ssh/id_rsa.pub | pbcopy