Skip to content

Instantly share code, notes, and snippets.

View jameshfisher's full-sized avatar
🏠
Working from home

Jim Fisher jameshfisher

🏠
Working from home
View GitHub Profile
@jameshfisher
jameshfisher / rename.sh
Created April 3, 2023 16:53
Shell function to rename file with filename editor
rename() {
[ "$#" -ne 1 ] && echo "Usage: rename <file_path>" && return 1
local temp_file=$(mktemp)
echo "$1" > "$temp_file"
"${EDITOR:-vi}" "$temp_file"
local new_path=$(cat "$temp_file")
mv "$1" "$new_path"
echo "$new_path"
rm "$temp_file"
}
@jameshfisher
jameshfisher / digital_ocean_spaces.js
Created November 15, 2021 11:18
Using Digital Ocean Spaces with S3 client in NodeJS
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
const s3AccessKeyId = "Y64W56U7IE85W46JH"; // Generate key at https://cloud.digitalocean.com/account/api/tokens
const s3SecretAccessKey = "y546wu7ie5u435y/7uei564sy5u6w57";
const s3Bucket = "foo"; // Assumes your Space is https://cloud.digitalocean.com/spaces/foo
const s3Region = "nyc3"; // Get this from "Endpoint" at https://cloud.digitalocean.com/spaces/foo/settings
const s3Endpoint = "https://nyc3.digitaloceanspaces.com"; // From "Endpoint" at https://cloud.digitalocean.com/spaces/foo/settings, prepend 'https://'
const s3Client = new S3Client({
$ curl -v https://unpkg.com/slate-react@0.66.7/dist/slate-react.js
* Trying 2606:4700::6810:7eaf...
* TCP_NODELAY set
* Connected to unpkg.com (2606:4700::6810:7eaf) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
@jameshfisher
jameshfisher / plot_tensorflow_graph.py
Created March 8, 2021 15:19
Plot a TensorFlow graph with graphviz/dot
import tensorflow as tf
try:
# pydot-ng is a fork of pydot that is better maintained.
import pydot_ng as pydot
except ImportError:
# pydotplus is an improved version of pydot
try:
import pydotplus as pydot
except ImportError:
@jameshfisher
jameshfisher / floyd.md
Created June 15, 2020 08:34
"The George Floyd Ritual" conspiracy theory piece

From https://www.godlikeproductions.com/forum1/message4424714/pg1, so you don't have to create an account. Discussed on Twitter.

The George Floyd Ritual Part 2

Criminal acts of brutality, violence, and bloodshed occur every day. Let's ignore those tragedies, and keep the spotlight on George Floyd, who the Media compares to Malcolm X and MLK.

In a previous post, linked below, I showed how George Floyd’s death was a ritual. Now we need to go down another rabbit hole, to examine the Masonic element to his death.

The ritual lasted 8 minutes and 46 seconds do you know why? Before I reveal the hidden meaning, I have to lay the groundwork. Numerically, the digits add up to 18, which is 6+6+6. Others might look for a Bible code, like John 8:46 or something of that nature. I’ll let you think about it.

@jameshfisher
jameshfisher / stravaBug.js
Created October 13, 2018 17:37
Demonstration that Strava Route Builder can't find routes at the prime meridian
// Open https://www.strava.com/routes/new, then copy/paste this code in the debug console.
// It should print results like this, showing that it can't find routes at the prime meridian:
//
// lng: -1.0, errCount: 0
// lng: -0.9, errCount: 0
// lng: -0.8, errCount: 1
// lng: -0.7, errCount: 0
// lng: -0.6, errCount: 0
// lng: -0.5, errCount: 0
// lng: -0.4, errCount: 0
(*
* to compile:
*
* $ patscc -DATS_MEMALLOC_LIBC gctest.dats
*
* NOTE: no GC here
*)
#include
"share/atspre_staload.hats"
@jameshfisher
jameshfisher / keybase.md
Created November 3, 2016 13:27
keybase.md

Keybase proof

I hereby claim:

  • I am jameshfisher on github.
  • I am jameshfisher (https://keybase.io/jameshfisher) on keybase.
  • I have a public key ASCYA1n1SBL09gPSYAODwLrEM29WPBhIc-z7hPGU5t2eIwo

To claim this, I am signing this object:

@jameshfisher
jameshfisher / 1gam.md
Last active August 29, 2015 14:13
One Game a Month plans

Non-Euclidean sokoban

Just like sokoban, except instead of being played on a 2d grid, it is played on graph-like structures with strange topologies (e.g. loops, mobius strips).

Randomness

Player must create as random a sequence as possible using the keyboard. Randomness is rewarded by pictures of random stuff.

@jameshfisher
jameshfisher / NonMonadicIO.hs
Created January 6, 2015 01:51
Non-monadic IO in Haskell
module NonMonadicIO where
import GHC.Base (returnIO, bindIO)
-- The IO API:
--
-- returnIO :: a -> IO a
-- bindIO :: IO a -> (a -> IO b) -> IO b
-- Here's a program which does nothing: