Skip to content

Instantly share code, notes, and snippets.

@LeZuse
LeZuse / Default.bttpreset
Last active March 26, 2019 09:21
Better Touch Tool config
{
"BTTPresetName" : "Default",
"BTTPresetUUID" : "CB3027C7-7330-45F9-AFAC-448FAD8856AD",
"BTTPresetContent" : [
{
"BTTAppBundleIdentifier" : "com.apple.finder",
"BTTAppName" : "Finder",
"BTTTriggers" : [
]
@LeZuse
LeZuse / apps.md
Last active May 2, 2020 18:32
Mac apps
@LeZuse
LeZuse / stats_logger.rb
Last active June 21, 2021 13:53
Puma plugin for stats logging on Heroku
Puma::Plugin.create do
def production?
ENV.fetch('RACK_ENV', 'development') == 'production'
end
def log(msg)
if production?
Rails.logger.info msg
else
puts msg
@LeZuse
LeZuse / spotify.sh
Last active June 5, 2019 15:00
A bash helper for controlling Spotify on Mac over osascript
#!/usr/bin/env bash
# Install:
# ln -s $PWD/spotify-cmd.sh /usr/local/bin/spotify
ARG=$@
usage () {
echo "Usage: $0 [play|pause|playpause|next track|previous track]"
}
@LeZuse
LeZuse / fck.bash
Last active June 28, 2018 13:26
Milujupraci.cz bash helper [CZ]
# Ever feel like nothing works? Put this into your .bash_profile and whenever you feel down run fuck from the bash prompt
function fuck() {
file=`curl milujupraci.cz 2>/dev/null | grep '<source' | grep mp3 | cut -d'"' -f2 | head -n $(( $RANDOM % 30 )) | tail -n1`
curl "milujupraci.cz/$file" 2>/dev/null >/tmp/x.mp3
afplay /tmp/x.mp3
}
@LeZuse
LeZuse / resque-failed-stats.js
Created May 21, 2018 16:17
Parse out unique class names from resque failed list
#!/bin/env node
const fs = require('fs');
// this takes a few seconds
// -u supported from v4
// redis-cli -u `heroku redis:credentials -a pb-com` lrange resque:failed 0 -1 > failed.txt
const log = fs.readFileSync('failed.txt', {encoding:'utf8'});
const ln = log.split('\n');
@LeZuse
LeZuse / example.sh
Created October 5, 2017 15:23
Restart Webpack on config change
$ yarn start
yarn run v1.1.0
$ nodemon
[nodemon] 1.12.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: webpack/webpack.config.js
[nodemon] starting `webpack-dev-server --config webpack/webpack.config.js`
Project is running at https://localhost:4201/
webpack output is served from /assets/
Content not from webpack is served from ***
@LeZuse
LeZuse / heroku-logs-response-time.js
Last active May 24, 2018 15:53
Heroku dyno load export to CSV
#!/usr/bin/env node
var fs = require('fs');
var execSync = require('child_process').execSync;
var DYNOS = 6;
var FROM = '2017-09-07T16:27:09Z';
var UNTIL = '2017-09-07T16:32:15Z';
// papertrail --min-time "2017-09-07T16:27:09Z" --max-time="2017-09-07T16:32:15Z" -- "dyno=web.3" > fail.web3.log
function getLog(number) {
@LeZuse
LeZuse / keybase.md
Created June 8, 2017 13:33
Keybase

Keybase proof

I hereby claim:

  • I am lezuse on github.
  • I am zuse (https://keybase.io/zuse) on keybase.
  • I have a public key ASDitNb2yVpOOWYi04Zp_1YooMnVVwWt8hjc6en6suBdBgo

To claim this, I am signing this object:

@LeZuse
LeZuse / nginx-dev-ssl.sh
Last active December 9, 2018 06:23
nginx development SSL setup on localhost
# copy default OpenSSL config
cp /usr/local/etc/openssl/openssl.cnf .
# make changes according to https://fbcs.co.uk/self-signed-multiple-domain-ssl-certificates/
vim openssl.cnf
# [alt_names]
# DNS.1 = localhost
# IP.1 = 0.0.0.0
# IP.2 = 127.0.0.1