Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rhietala's full-sized avatar

Risto Hietala rhietala

View GitHub Profile
/**
* Convert URLSearchParams object to js object
*
* Supports arrays so that if the same key is found more than once,
* convert it to an array.
*
* Removes also `[]` characters from the end of a key and sets that
* key as an array even if there was only one value.
*
* @param u url search params to be converted
@rhietala
rhietala / cond-pattern-matching.ts
Last active September 17, 2019 20:32
poor man's pattern matching (of values, not types) with lodash cond
import {
cond,
constant,
defaultTo,
fromPairs,
isMatch,
isUndefined,
keys,
map,
omitBy,
#!/bin/bash
# Check SSL expiry dates
#
# This script can be used to check SSL certificate expiry dates for
# given list of domains.
#
#
# Usage
# ./check-ssl-expiry.sh
#!/bin/bash
# Old files removal tool
#
# This script can be used to remove old files (e.g. daily backups)
# so that some are kept.
#
# Files are kept if they are:
# - Less than 30 days old
# - Less than a year old and created on monday
# filter 5xx rows from haproxy log:
:filter-in \d+/\d+/\d+/\d+/\d+ 5
@rhietala
rhietala / beets_config.yaml
Created February 3, 2018 08:01
Beets config
directory: /Volumes/2bigraid/musiikkia
library: /Volumes/2bigraid/musiikkia/musiclibrary.blb
asciify_paths: yes
paths:
default: %the{$albumartist}/$album/$track $title
import:
move: yes
plugins: discogs lastgenre fetchart ftintitle smartplaylist random embedart convert the rewrite absubmit acousticbrainz info chroma play
embedart:
auto: yes

Keybase proof

I hereby claim:

  • I am rhietala on github.
  • I am ristohietal (https://keybase.io/ristohietal) on keybase.
  • I have a public key ASB1awTCdoplAnRsvLcQMF4tMg_24-bJGyiT-LqdrB2usQo

To claim this, I am signing this object:

@rhietala
rhietala / flac-to-aac.sh
Created June 26, 2017 20:31
Convert flac to aac (m4a)
#!/bin/bash
#
# Convert all .flac music files to .m4a (aac) for itunes/ios use
#
# Install ffmpeg with fdk_aac (uninstall first if built without it):
# $ brew install ffmpeg --with-fdk-aac
#
# The script assumes the following directory structure:
# ./musiikkia/
# ./musiikkia/whatever/song.flac
@rhietala
rhietala / gist:7578453
Created November 21, 2013 09:20
tinyfugue low ep
/def -i -F -mregexp -t"^H:([0-9]+)/[0-9]+ \[.*\] S:([0-9]+)/[0-9]+ \[.*\] E:([0-9]+)/[0-9]+ \[.*\] \$:([0-9]+) \[.*\] exp:([0-9]+) \[.*\]$" low_ep_warn =\
/if (%{P3} <= 30)\
party report LOW EP%%;\
/endif