Skip to content

Instantly share code, notes, and snippets.

View kotnik's full-sized avatar

Nikola Kotur kotnik

View GitHub Profile
@kotnik
kotnik / hook.sh
Created August 1, 2016 08:41
Git update hook to allow only signed commits
#!/usr/bin/env bash
##############################################################################
#
# check-commit-signature
# ----------------------
# A server-side update git hook for checking the GPG signature of a pushed
# commit.
#
# To enable this hook, rename this file to "update".
#
-- Logs begin at Thu 2015-12-10 11:32:31 CET, end at Tue 2016-05-10 22:58:29 CEST. --
May 10 21:29:17 carpo systemd-journald[284]: Runtime journal (/run/log/journal/) is 8.0M, max 787.6M, 779.6M free.
May 10 21:29:17 carpo systemd-journald[284]: System journal (/var/log/journal/) is 1.9G, max 4.0G, 2.0G free.
May 10 21:29:17 carpo systemd-journald[284]: Time spent on flushing to /var is 96.647ms for 2 entries.
May 10 21:29:17 carpo kernel: Linux version 4.5.3-1-ARCH (builduser@tobias) (gcc version 6.1.1 20160501 (GCC) ) #1 SMP PREEMPT Sat May 7 20:43:57 CEST 2016
May 10 21:29:17 carpo kernel: Command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=92fdeb9f-682d-475b-b60c-40d7a224d7de rw cryptdevice=/dev/sda2:cryptroot quiet
May 10 21:29:17 carpo kernel: x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
May 10 21:29:17 carpo kernel: x86/fpu: Supporting XSAVE feature 0x01: 'x87 floating point registers'
May 10 21:29:17 carpo kernel: x86/fpu: Supporting XSAVE feature 0x02: 'SSE registers'
May 10 21:29:17 carpo ke
#!/usr/bin/env python3
import sys
import datetime
import subprocess
from collections import Counter
if __name__ == '__main__':
hours = {}
location /.well-known/acme-challenge {
default_type text/plain;
alias /srv/<%= @user %>/www/.well-known/acme-challenge;
}
location ~ ^/(?!\.well-known)\..*$ { return 403; }
@kotnik
kotnik / pastebin.sh
Last active August 26, 2015 10:17 — forked from ralt/pastebin.sh
putfile & pastebin
#!/bin/bash
file=$(mktemp ~/Documents/Pastes/XXXXXX)
mv $file $file.html
file="$file.html"
chmod 644 ${file}
[[ ! -z "$1" ]] && lang="-s $1"
cat - > ${file}.in
www.rts.rs
www.blic.rs
www.b92.net
www.kurir-info.rs
www.novosti.rs
www.24sata.rs
www.mondo.rs
smedia.rs
www.limundo.com
www.kupujemprodajem.com

Keybase proof

I hereby claim:

  • I am kotnik on github.
  • I am kotnik (https://keybase.io/kotnik) on keybase.
  • I have a public key whose fingerprint is CED8 F1EC DADD 599B 1215 70B5 C392 619A D8C0 813B

To claim this, I am signing this object:

#!/usr/bin/env python3
import fileinput
import json
import statistics
def pr_line(i, j, k):
print("%s %s %s" % (i.ljust(40), j.rjust(10), k.rjust(10)))
def main():
@kotnik
kotnik / battery_check.py
Created October 23, 2014 09:45
Change background to red on low battery.
#!/usr/bin/env python3
import os
import time
import argparse
from subprocess import check_call
def cli_options():
parser = argparse.ArgumentParser()
parser.add_argument(
$ git push
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 567 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
Processing activity environment.push
Found 1 new commit.