Skip to content

Instantly share code, notes, and snippets.

View d2s's full-sized avatar

Daniel Schildt d2s

View GitHub Profile
@vielmetti
vielmetti / hello.sh
Created July 19, 2023 05:18
hello.sh
#!/bin/sh
# echo is from Doug McIlroy, 1972
# dd ("copy and convert", or "disk destroyer"), 1974
echo hello world | dd conv=ucase
# sed from 1974; sed -E is later
echo "Hello World" | sed -E 's/(.)/\1\n/g'
# awk is from 1977
awk 'BEGIN { print "Hello World" }'
echo "World Hello" | awk '{print $2, $1}'
# rs (reshape) is from 1983, 4.2 BSD

bad practice

sudo npm i -g <module>

good practice

npm config set prefix 
@simonw
simonw / readme.md
Created March 26, 2020 16:16
Making a Datasette of Finnish coronavirus data

TypeScript intro

How to setup TypeScript and use in a normal JavaScript project for learning purposes.

Preparations

  • mkdir lab-ts
  • cd lab-ts
  • git init
  • touch .gitignore. Add node_modules and dist to the file.
@NeilJS
NeilJS / gist:32ac664f846bdea9aac25a428fe3727a
Created September 30, 2019 08:24
Chrome snippet: designMode="on" + kill all links
// Disable anchor links
window.addEventListener("click", function (event) {
event.preventDefault();
});
// Disable click eventlisteners
window.addEventListener("click", function (event) {
event.stopPropagation();
}, true);
// design mode on
document.designMode = "on";
@tatianamac
tatianamac / tatiana-mac-speaker-rider.md
Last active September 19, 2024 17:22
Tatiana Mac's Speaker Rider

Speaker Rider

by Tatiana Mac

Last updated 14 April 2021

What is a speaker rider?

As speaking comes with immense privilege, I have crafted a speaker rider to set expectations and boundaries around my engagement. I am grateful to all the conference organisers who have brilliantly hosted me. I would love to continue to exercise this privilege to speak at conferences, and use this privilege to make the landscape more accessible and beneficial to tech's most historically excluded and marginalised communities.

Considerations

😫 I provide a lot of explanations for those of you who never had to consider these things. Most thoughtful conferences I've attended check most of these boxes intrinsically, particularly when conference runners are experienced speakers. They get it.

const Torus3D = {
props: {
// 3D -> 2D projection settings
camera: {
type: 'orthographic',
zoom: 2.25,
position: [ 1, 1, 1 ]
},
// Vertex transformation before screen space transformation
transform: {
@d2s
d2s / pull-changes-from-upstream.sh
Created June 20, 2019 18:56
Pull changes from an upstream Git repository
#!/usr/bin/env bash
# Add `upstream` Git repository
# git remote add upstream https://github.com/d2s/companies.git
# Merge latest changes from the `upstream` Git repository
git fetch upstream
git checkout master
git merge upstream/master
listening() {
if [ $# -eq 0 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P
elif [ $# -eq 1 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color $1
else
echo "Usage: listening [pattern]"
fi
}
@illvart
illvart / meta-seo.njk
Last active March 10, 2020 22:10
My Eleventy project meta-seo.njk
{% if permalink == "/" %}
{% set canonicalUrl = metadata.canonicalUrl %}
{% else %}
{% set canonicalUrl = metadata.canonicalUrl + page.url %}
{% endif %}
<link rel="canonical" href="{{ canonicalUrl }}">
{# Social meta #}
{% if section == "articles" %}
<meta property="og:type" content="blog">
{% else %}