Skip to content

Instantly share code, notes, and snippets.

View bjonord's full-sized avatar

Björn Nordstrand bjonord

View GitHub Profile
@bjonord
bjonord / keybase
Created March 10, 2023 14:05
keybase
### Keybase proof
I hereby claim:
* I am bjonord on github.
* I am bjonord (https://keybase.io/bjonord) on keybase.
* I have a public key ASDkKmU5dMwJPyn1qF6ML-LKa4yg2QSakwghhjV-xljSUQo
To claim this, I am signing this object:
@bjonord
bjonord / keybindings.md
Last active February 19, 2021 22:55 — forked from rnwolf/spacemacs-keybindings.md
Keybindings

Zoxide

https://github.com/ajeetdsouza/zoxide#examples

z foo       # cd to highest ranked directory matching foo
z foo bar   # cd to highest ranked directory matching foo and bar

z foo/      # can also cd into actual directories

zi foo # cd with interactive selection using fzf
@bjonord
bjonord / dig_the_world.exs
Last active February 11, 2022 23:39
Run dig against several different public DNS servers
#!/usr/bin/env elixir
domain = System.argv()
defmodule GlobalDig do
@dns_servers %{
bahnhof_se: "213.80.98.2",
cloudflare: "1.1.1.1",
comodo_us: "8.26.56.26",
dyn: "216.146.35.35",
# Get a local copy of the destination project state
cd project_dest
terraform state pull > remote.tfstate
# Move from the SRC project to the DEST project
cd ../project_src
terraform state mv \
-state-out=../project_dest/remote.tfstate \
module.XYZ module.XYZ

Keybase proof

I hereby claim:

  • I am bjonord on github.
  • I am bjonor (https://keybase.io/bjonor) on keybase.
  • I have a public key ASAodpIV65BzYuIQhZMT3GtEwzRJL_5l2zURm-loSNnw8Ao

To claim this, I am signing this object:

@bjonord
bjonord / print_order_pdf.rb
Last active November 3, 2017 13:43
some TS thing
def print_online_order(order)
transaction do
order.lock!
do_print_summary = current_account.setting('print_summary_for_online_orders')
policies = {"Customer" => {"online" => false}}
printer = Printing::Printer.new(order, nil, [], print_ticket_summary: do_print_summary,
policies: policies)
printables = printer.printable_pages
@bjonord
bjonord / 50-synaptics.conf
Created September 6, 2014 10:48
thinkpad helix only touchpoint
# Example xorg.conf.d snippet that assigns the touchpad driver
# to all touchpads. See xorg.conf.d(5) for more information on
# InputClass.
# DO NOT EDIT THIS FILE, your distribution will likely overwrite
# it when updating. Copy (and rename) this file into
# /etc/X11/xorg.conf.d first.
# Additional options may be added in the form of
# Option "OptionName" "value"
#
Section "InputClass"
#!/usr/bin/env ruby
hits_ = nil
misses_ = nil
loop do
`redis-cli info | grep keyspace` =~ /hits:(\d+).*misses:(\d+)/m
hits, misses = $1.to_i, $2.to_i
if hits_
@bjonord
bjonord / keyboard-switcher.sh
Created July 19, 2014 23:38
keyboard-switcher
#!/bin/zsh
# If an explicit layout is provided as an argument, use it. Otherwise, select the next layout from
# the set [us(colemak), us(altgr-intl), se].
if [[ -n "$1" ]]; then
setxkbmap $1 -variant $2
else
layout=$(setxkbmap -query | awk '$1 ~/layout/ {print $2}')
variant=$(setxkbmap -query | awk '$1 ~/variant/ {print $2}')
case $layout$variant in
@bjonord
bjonord / resque_initd.sh
Last active January 3, 2016 05:09
init.d and monitrc file for resque-pool - https://github.com/nevans/resque-pool
#!/bin/sh -e
APP_NAME="xxxx"
APP_DIR="/var/www/${APP_NAME}/current"
PIDFILE="${APP_DIR}/tmp/pids/${APP_NAME}_resque"
RUN_AS="rails"
SLEEP_TIME=5
ENV="production"
STDOUT="${APP_DIR}/log/resque-pool.log"
STDERR="${APP_DIR}/log/resque-pool-error.log"