Skip to content

Instantly share code, notes, and snippets.

@atmoz
atmoz / lfrc
Created Mar 9, 2020
Recursive content search with FZF in LF
View lfrc
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 Mar 9, 2022
Minetest server for beta map
View Dockerfile
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/*
View interval.go
package main
import (
"fmt"
"os"
"sort"
"strconv"
"strings"
"github.com/docopt/docopt-go"
View i3config_example
# ...
# 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"
View keybase.md

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 Mar 18, 2017
Notify on low battery and hibernate before empty
View battery-guard
#!/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 Aug 24, 2017
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/
View suspend-to-hibernate.service
[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 Aug 24, 2016
Working netctl profile for eduroam on the University of Bergen
View wlp3s0-eduroam
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 Apr 23, 2022
JUnit Bash script - run JUnit tests with ease in CLI
View junit
#!/bin/bash
#
# NAME
# junit - run JUnit tests with ease
#
# USAGE
# junit [FILE... | CLASS... | DIR]
#
# EXAMPLES
# junit
@atmoz
atmoz / bad
Created Apr 7, 2015
if-else-nesting-hell
View bad
if (a) {
do A
if (b) {
do B
if (c) {
do C
}
else {