Skip to content

Instantly share code, notes, and snippets.

@trnila
trnila / update.sh
Last active February 17, 2017 10:28
Create or update AAAA dns record on cloudflare
#!/bin/bash
[email protected]
pass=insert_apikey
zone_id=insert_zone_id
domain=$(hostname --fqdn)
addr=$(ip a | grep 'inet6 2001' | awk '{print $2}' | cut -d '/' -f 1)
if [ "$domain" == "arch" ]; then
echo "not updating"
@trnila
trnila / cmd_not_found.sh
Created February 2, 2017 16:52
Install package that is not found in Archlinux with packer
#!/bin/bash
query=$1
options=$(packer -Ss "$query" | awk -f <(cat - <<-'EOD'
function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s }
/^[^ ]/ {
printf("\"%s\" ", $1);
desc=1;
}
/^ / {
@trnila
trnila / Makefile
Last active July 26, 2016 00:45
Openwrt BUP package
# https://groups.google.com/d/msg/bup-list/HIeue2eiIKc/slcMnIywtoMJ
include $(TOPDIR)/rules.mk
PKG_NAME:=bup
PKG_VERSION:=0.28.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/bup/bup/archive/
@trnila
trnila / main.c
Created February 29, 2016 22:51
fork
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
int main() {
int mypipe[2];
pipe(mypipe);