Skip to content

Instantly share code, notes, and snippets.

View crates's full-sized avatar
❤️‍🔥
Crates is CEO of llnnll.com, Athames.com, Crates.Media / Cr8s.Net : 844-CR8S-NET

Crates crates

❤️‍🔥
Crates is CEO of llnnll.com, Athames.com, Crates.Media / Cr8s.Net : 844-CR8S-NET
View GitHub Profile
@crates
crates / git-prompt.sh
Created August 26, 2021 14:58
bash/zsh git prompt support shell script
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
@crates
crates / wget-commands.txt
Created November 11, 2020 16:51
Here are some examples of wget commands you can use to spider/crawl the contents of a website
wget -r -l5 -U "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0" -c -D english.grimoar.cz --max-redirect 0 --no-parent -w .5 http://english.grimoar.cz/
wget -r -l5 -U "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0" -c -D krishnamurti.abundanthope.org --max-redirect 0 --no-parent -w .5 http://krishnamurti.abundanthope.org/index_htm_files/
wget -r -l5 -U "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0" -c -D krishnamurti.abundanthope.org --max-redirect 0 --no-parent -w .5 http://krishnamurti.abundanthope.org/index_htm_files/
wget -r -l5 -U "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0" -c -D www.teachittome.com --max-redirect 0 --no-parent -w .5 http://www.teachittome.com/Chinuch/
wget -r -l5 -U "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0" -c -D fas.org --max-redirect 0 --no-parent -w .5 http://fas.org/irp/doddir/
@crates
crates / MacOS-Open-Windows.py
Created November 3, 2020 14:07
Get information about open windows on MacOS
#!/usr/bin/env python
import Quartz # if you get an error with this import, run `pip install pyobjc-framework-Quartz`
import time
from Foundation import NSSet, NSMutableSet
def transformWindowData(data):
list1 = []
for v in data:
if not v.valueForKey_('kCGWindowIsOnscreen'):
continue
// This will safely check a value to make sure it has been declared and assigned a value other than null or undefined:
console.log(typeof undeclaredVariable !== "undefined" &&
(typeof undeclaredVariable !== "object" || !undeclaredVariable)) // false
// Compare to checking for null using ==, which will only work for declared variables:
try { undeclaredVariable == null } catch(e) { console.log(e) } // ReferenceError: undeclaredVariable is not defined
try { undeclaredVariable === null } catch(e) { console.log(e) } // ReferenceError: undeclaredVariable is not defined
try { undeclaredVariable === undefined } catch(e) { console.log(e) } // ReferenceError: undeclaredVariable is not defined
let declaredButUndefinedVariable
@crates
crates / SmoothScroll.js
Created July 8, 2020 15:08
Use for video casts or any time you need smooth scrolling action
// SmoothScroll.js: Use for video casts or any time you need smooth scrolling action
// usage: new SmoothScroll(target, speed, smooth)
// eg. new SmoothScroll(document, 120, 12)
function SmoothScroll(target, speed, smooth) {
if (target === document)
target = (document.scrollingElement
|| document.documentElement
|| document.body.parentNode
|| document.body) // cross browser support for document scrolling
@crates
crates / sdf-svg-heatmap.ts
Created June 23, 2020 16:43 — forked from postspectacular/sdf-svg-heatmap.ts
Shroomania: SDF SVG heatmap
import { DisjointSet } from "@thi.ng/adjacency";
import { cosineColor, GRADIENTS } from "@thi.ng/color";
import { identity, partial } from "@thi.ng/compose";
import { serialize } from "@thi.ng/hiccup";
import { rect, svg, text } from "@thi.ng/hiccup-svg";
import { fitClamped, wrap } from "@thi.ng/math";
import { IRandom, Smush32 } from "@thi.ng/random";
import {
buildKernel2d,
comp,
@crates
crates / daily-log.md
Created June 16, 2020 18:45
Use this template to log how you spend your time, plan out your day, and do some question-driven daily journaling!

Day of Tiw: June 16, 2020

Week 25/52: Day 168 of 366 (198 left)

45.9% thru 2020; 84.7% thru Q2

I want 2020 to be, hands-down, unequivocally, incontrovertibly, the best year of my life. That will require daily commitment! Every day, I need to reaffirm my goals and direction before getting started. I need to make my actions congruent with my goals. I've already laid out what that will look like with some goals for each month. I will follow this plan as closely as possible.

It's very easy to lose time to the television set, so it's extra important to make sure the day's commitments are met FIRST.

@crates
crates / jQuery-Browser-Detection.js
Created May 18, 2020 16:54
jQuery-based Browser Detection and Class Addition
function applyUserAgentClasses() { // jQuery.browser emulated for jQ 1.9+ support
jQuery.browser = {};
jQuery.browser.mozilla = false;
jQuery.browser.webkit = false;
jQuery.browser.opera = false;
jQuery.browser.msie = false;
var nAgt = navigator.userAgent;
jQuery.browser.name = navigator.appName;
jQuery.browser.fullVersion = ''+parseFloat(navigator.appVersion);
@crates
crates / .bashrc
Last active June 8, 2021 21:29
An excellent .bashrc script for styling the bash prompt on Mac OS
# In order to use this script, you should copy git-prompt.sh from here...
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
# ... into here: /usr/local/share/bash-completion/git/git-prompt.sh
# You might consider following these commands after copying that file:
# sudo mkdir -p /usr/local/share/bash-completion/git
# sudo cat > /usr/local/share/bash-completion/git/git-prompt.sh
# (paste the contents of the file, then press Enter and then CTRL-D)
# sudo chmod -R 755 /usr/local/share/bash-completion
@crates
crates / mersenne-twister.js
Created April 13, 2020 13:50 — forked from banksean/mersenne-twister.js
a Mersenne Twister implementation in javascript. Makes up for Math.random() not letting you specify a seed value.
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();