Skip to content

Instantly share code, notes, and snippets.

View hs0ucy's full-sized avatar
💭
"Hyperlinks subvert (hack) hierarchy"

Hugo Soucy hs0ucy

💭
"Hyperlinks subvert (hack) hierarchy"
View GitHub Profile
### extract videos as mp3 files
youtube-dl -x --audio-format mp3 <video link>
### get highest resolution audio & video
To download a video, you type the URL after the command like so:
youtube-dl <video link>
To select the video quality, first use the -F option to list the available formats, here’s an example,
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 8, 2024 21:42
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;
}
@tst2005
tst2005 / deadlink.sh
Last active April 12, 2018 13:16
shell script to search about deadlink
@meskarune
meskarune / weather.lua
Last active May 6, 2022 05:07
lua weather script
#!/usr/bin/lua
-- load the http socket module
http = require("socket.http")
-- load the json module
json = require("json")
api_url = "http://api.openweathermap.org/data/2.5/weather?"
-- http://openweathermap.org/help/city_list.txt , http://openweathermap.org/find
cityid = "5128581"
@sergeyklay
sergeyklay / sed-cheatsheet.md
Last active May 12, 2024 20:49
Sed Cheatsheet

Sed Cheat Sheet

Sed command line options

sed [options] sed-command [input-file]
Option Description Example
@afresh1
afresh1 / get_dns_blacklists.sh
Last active June 12, 2018 19:55 — forked from tvlooy/get_dns_blacklists.sh
Block ads by DNS
#!/bin/sh
# "include: /var/unbound/etc/ad-blacklist.conf" in /var/unbound/etc/unbound.conf
# run script as daily cron
TMPFILE=$( mktemp get_dns_blacklists-XXXXXXXXX )
trap 'rm -f $TMPFILE; exit 1' EXIT KILL INT QUIT TERM
(
ftp -VM -o- https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | grep ^0.0.0.0 | awk '{ print $2 }'
/*
* An URI datatype. Based upon examples in RFC3986.
*
* TODO %-escaping
* TODO split apart authority
* TODO split apart query_string (on demand, anyway)
*
* @(#) $Id$
*/
@Eloi
Eloi / browser_automation.sh
Last active December 1, 2021 18:24
Simple shellscript to easily reload browser/terminal/other windows, without losing focus on the current window. Bind it to some useful key shortcut (p.e. win+r) to speed up web development process ;)
#!/bin/sh
if [ -n "$1" ]; then
if [ "$1" = "grab_id" ]; then
xdotool selectwindow >/tmp/autoreload_window_id
elif [ "$1" = "reload" ]; then
WINDOWID=`cat /tmp/autoreload_window_id`
@paulirish
paulirish / what-forces-layout.md
Last active May 12, 2024 13:20
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@wilfm
wilfm / grephexcolourcode
Created September 14, 2015 17:54
Grep Hex Colour Codes from file
#!/bin/bash
#get hex codes in form #fff and #ffffff
#checks to see if not - especially needed on #fff matches
#FIXME: - currently prints trailing character
if [[ ! -a $1 ]]; then
echo File not found
exit 1
fi
sed ':a;N;$!ba;s/\n/ /g' "$1" | grep -o '\#[0-9a-fA-F]\{3\}[^0-9a-fA-F]' | sed 's/[^0-9a-fA-F#]//g' | sort -u