Skip to content

Instantly share code, notes, and snippets.

@atmoz
atmoz / lfrc
Created March 9, 2020 07:56
Recursive content search with FZF in LF
map ` ${{
fz=$(grep --line-buffered --color=never -r -n "" * \
| fzf -d: -e -m -n3.. \
--preview 'head -$LINES {1} | grep --color=always -i -e "^" -e {q}' --preview-window=noborder \
--layout=reverse \
| cut -d: -f1 | sort | uniq)
if [ -n "$fz" ]; then
pwd=$PWD
for f in $fz; do
d=$(dirname $f)
@atmoz
atmoz / Dockerfile
Last active March 9, 2022 00:55
Minetest server for beta map
FROM registry.gitlab.com/minetest/minetest/server:5.0.1
USER root
RUN apt-get update && \
apt-get install -y git
RUN rm -rf /usr/local/share/minetest/games/*; \
git clone --recursive https://github.com/MT-CTF/capturetheflag.git /usr/local/share/minetest/games/capturetheflag && \
rm -f /usr/local/share/minetest/games/capturetheflag/mods/ctf/ctf_map/maps/*
package main
import (
"fmt"
"os"
"sort"
"strconv"
"strings"
"github.com/docopt/docopt-go"
# ...
# assuming $mod and $dmenuOptions are set
set $passMenu "pass: [p]assword [l]ogin [b]rowse"
bindsym $mod+p mode $passMenu
mode $passMenu {
bindsym p exec --no-startup-id ~/bin/passmenu --type -- $dmenuOptions; mode "default"
bindsym l exec --no-startup-id ~/bin/passmenu --type --get username:password --enter -- $dmenuOptions; mode "default"
bindsym b exec --no-startup-id ~/bin/passmenu --type --browse -- $dmenuOptions; mode "default"

Keybase proof

I hereby claim:

  • I am atmoz on github.
  • I am atmoz (https://keybase.io/atmoz) on keybase.
  • I have a public key whose fingerprint is 8384 60D0 CBD2 6750 AB26 DF8F B9FB 68F9 8F88 BA47

To claim this, I am signing this object:

@atmoz
atmoz / battery-guard
Last active March 18, 2017 17:55
Notify on low battery and hibernate before empty
#!/bin/sh
export DISPLAY=":0"
notice_0=50
warning_0=25
critical_0=10
notice_1=50
warning_1=10
@atmoz
atmoz / suspend-to-hibernate.service
Last active December 14, 2022 13:48
Systemd services to hibernate after 2 hours of suspend. This is to increase security and battery usage while preserving a fast resume in working hours. Put files in /etc/systemd/system/
[Unit]
Description=Delayed hibernation trigger
Documentation=https://bbs.archlinux.org/viewtopic.php?pid=1420279#p1420279
Documentation=https://wiki.archlinux.org/index.php/Power_management
Conflicts=hibernate.target hybrid-suspend.target
Before=sleep.target
StopWhenUnneeded=true
[Service]
Type=oneshot
@atmoz
atmoz / wlp3s0-eduroam
Created August 24, 2016 10:08
Working netctl profile for eduroam on the University of Bergen
Connection='wireless'
Interface=wlp3s0
Security='wpa-configsection'
Description="eduroam network"
IP='dhcp'
TimeoutWPA=30
WPAConfigSection=(
'ssid="eduroam"'
'key_mgmt=WPA-EAP'
'eap=PEAP'
@atmoz
atmoz / junit
Last active April 23, 2022 23:13
JUnit Bash script - run JUnit tests with ease in CLI
#!/bin/bash
#
# NAME
# junit - run JUnit tests with ease
#
# USAGE
# junit [FILE... | CLASS... | DIR]
#
# EXAMPLES
# junit
@atmoz
atmoz / bad
Created April 7, 2015 11:40
if-else-nesting-hell
if (a) {
do A
if (b) {
do B
if (c) {
do C
}
else {