Skip to content

Instantly share code, notes, and snippets.

View Treer's full-sized avatar

Treer

  • Australia
  • 23:31 (UTC +11:00)
View GitHub Profile
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active November 4, 2024 07:33
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@13Cubed
13Cubed / update_aws.sh
Last active March 30, 2020 09:43
Update AWS Route 53 and EC2 Security Group upon change in dynamic IP address. Roll your own dynamic DNS service, and update associated security groups by adding the new IP and cleaning up the previous IP to prevent unauthorized access to EC2 instances. Note: calls AWS CLI, and cli53 to make Route 53 changes (https://github.com/barnybug/cli53).
#!/bin/bash
ZONE="example.com"
HOSTNAME="test"
SGROUP="my_security_group"
CURRENT_IP=$(dig @resolver1.opendns.com myip.opendns.com +short)
OLD_IP=$(dig @resolver1.opendns.com $HOSTNAME.$ZONE +short)
if [[ $CURRENT_IP =~ [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ ]] ; then
@RikkiGibson
RikkiGibson / adt.ts
Created March 11, 2016 23:44
Fake ADTs in TypeScript
type Meters = { meters: number };
type Feet = { feet: number };
type Distance = Meters | Feet;
function isMeters(distance: Distance): distance is Meters {
return typeof (distance as Meters).meters === 'number';
}
function isFeet(distance: Distance): distance is Feet {
return typeof (distance as Feet).feet === 'number';
}
@pygy
pygy / lutn.lua
Last active October 12, 2021 08:01
lutn: Load a JSON-like Lua expression, securely. (see also: ltin)
-- Loads a single Lua expression as a JSON-like document, securely.
-- function expressions are prohibited, and the __index of the
-- strings metatable is temporarily stripped or replaced.
-- see also: ltin
-- usage:
-- lutn = require "lutn"
-- result = lutn(source_string [, environment = nil] [, string_metatable_index = nil])