Skip to content

Instantly share code, notes, and snippets.

View StevenBlack's full-sized avatar
🇨🇦

Steven Black StevenBlack

🇨🇦
View GitHub Profile
@StevenBlack
StevenBlack / defaulthosts
Created April 13, 2020 04:25
All-purpose default hosts
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
127.0.0.1 local
255.255.255.255 broadcasthost
::1 localhost
::1 ip6-localhost
::1 ip6-loopback
fe80::1%lo0 localhost
ff00::0 ip6-localnet
ff00::0 ip6-mcastprefix
@StevenBlack
StevenBlack / debian_setup.sh
Created August 20, 2023 17:29
Debian setup
#!/bin/sh
cd ~
rm -rf Music
rm -rf Pictures
rm -rf Documents
rm -rf Videos
rm -rf Templates
rm -rf Public
mkdir projects
@StevenBlack
StevenBlack / gist:960189
Created May 7, 2011 04:05
getContrastYIQ(hexcolor)
// for contrasting text color
// Original article: http://24ways.org/2010/calculating-color-contrast
function getContrastYIQ(hexcolor){
var r = parseInt(hexcolor.substr(0,2),16);
var g = parseInt(hexcolor.substr(2,2),16);
var b = parseInt(hexcolor.substr(4,2),16);
var yiq = ((r*299)+(g*587)+(b*144))/1000;
return (yiq >= 131.5) ? 'black' : 'white';
}
@StevenBlack
StevenBlack / contribution-history.md
Last active July 30, 2022 03:18
Source Host Files' Contribution History
@StevenBlack
StevenBlack / 100bytes.css
Created June 18, 2022 15:09
Between 100 and 200 bytes of solid css.
// source: https://www.swyx.io/css-100-bytes
html {
max-width: 70ch;
padding: 3em 1em;
margin: auto;
line-height: 1.75;
font-size: 1.25em;
}
h1,h2,h3,h4,h5,h6 {
@StevenBlack
StevenBlack / 1M-TLD.md
Created June 16, 2022 15:16
Top 1-million domains TLD breakdown

See the conversation here: StevenBlack/hosts#1956

$ ghosts --tld -m /Users/steve/Downloads/top-1m.txt   

----------------------------------------
Base hosts file summary:
----------------------------------------
Location: /Users/steve/Downloads/top-1m.txt
Domains: 999,295
@StevenBlack
StevenBlack / pullall.sh
Last active April 16, 2022 21:15
git pull in all sub directories
# Run "git pull" in each subdirectory of the current directory.
# Useful when you store all of your git repos in one folder.
clear
for dir in ./*; # For every item in the folder:
do (
if [ -d "$dir" ]; # If it is a directory:
then (
echo "$dir" && # Print the path,
@StevenBlack
StevenBlack / MacOS Allow Apps from any developer.sh
Created April 15, 2022 16:44
MacOS allow apps from any developer
sudo spctl --master-disable

General OpenSSL Commands

These commands allow you to generate CSRs, Certificates, Private Keys and do other miscellaneous tasks.

  • Generate a new private key and Certificate Signing Request
openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
  • Generate a self-signed certificate (see How to Create and Install an Apache Self Signed Certificate for more info)
@StevenBlack
StevenBlack / shtdn.bat
Created February 11, 2022 23:08
Shutdown a remote network machine
shutdown -r -m \\MachineName -t -0