Skip to content

Instantly share code, notes, and snippets.

@01100001
01100001 / falsehoods-programming-time-list.md
Created December 3, 2021 12:44 — forked from timvisee/falsehoods-programming-time-list.md
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@01100001
01100001 / unbound.conf
Created September 28, 2021 15:27 — forked from Overbryd/unbound.conf
A pretty good unbound.conf, DNSSEC, caching and local forwarding
remote-control:
control-enable: yes
server:
do-ip6: no
do-ip4: yes
do-udp: yes
tls-cert-bundle: /etc/ssl/certs/ca-certificates.crt
num-threads: 4
# Enable logs
verbosity: 1
@01100001
01100001 / functions.php
Created July 24, 2020 14:53 — forked from remcotolsma/functions.php
Custom WordPress the_terms() function to sort the post terms by "Category Order and Taxonomy Terms Order".
<?php
/**
* The terms
*/
function prefix_the_terms( $post_id, $taxonomy ) {
$term_ids = wp_get_post_terms( $post_id, $taxonomy, array(
'fields' => 'ids',
) );
@01100001
01100001 / ImageMagick Fake Scanned Document.sh
Last active July 18, 2022 11:26 — forked from andyrbell/scanner.sh
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@01100001
01100001 / git-extract-file.markdown
Created November 19, 2016 10:53 — forked from ssp/git-extract-file.markdown
Extract a single file from a git repository

How to extract a single file with its history from a git repository

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch