Skip to content

Instantly share code, notes, and snippets.

View corpix's full-sized avatar
👹
Fighting demons

corpix corpix

👹
Fighting demons
View GitHub Profile
@corpix
corpix / ip6.nix
Last active January 28, 2018 01:33
My very naive implementation of IP6 address expansion in nix language
/*
$ nix-instantiate --eval --expr 'with (import <nixpkgs> {}); with lib; builtins.toJSON ((import ./ip6.nix { lib = pkgs.lib; }).expandIP6 "ea5f::")' | jq -r . | jq .
"ea5f:0000:0000:0000:0000:0000:0000:0000"
$ nix-instantiate --eval --expr 'with (import <nixpkgs> {}); with lib; builtins.toJSON ((import ./ip6.nix { lib = pkgs.lib; }).expandIP6 "::ea5f")' | jq -r . | jq .
"0000:0000:0000:0000:0000:0000:0000:ea5f"
$ nix-instantiate --eval --expr 'with (import <nixpkgs> {}); with lib; builtins.toJSON ((import ./ip6.nix { lib = pkgs.lib; }).expandIP6 "ea5f::ff")' | jq -r . | jq .
"ea5f:0000:0000:0000:0000:0000:0000:00ff"
*/
This file has been truncated, but you can view the full file.
Jan 21 21:18:09: ----- cjdns memory snapshot -----
Jan 21 21:18:09: Core.c:338 [157264] bytes
Jan 21 21:18:09: ASynchronizer.c:102 [480] bytes
Jan 21 21:18:09: | UDPAddrIface.c:199 [13000] bytes
Jan 21 21:18:09: | | ASynchronizer.c:104 [64] bytes at [0x55b2f716daf0]
Jan 21 21:18:09: | | ASynchronizer.c:104 [64] bytes at [0x55b2f716daa0]
Jan 21 21:18:09: | | Message.h:86 [88] bytes at [0x55b2f716da40]
Jan 21 21:18:09: | | Message.h:75 [4088] bytes at [0x55b2f716ca40]
Jan 21 21:18:09: | | ASynchronizer.c:104 [64] bytes at [0x55b2f716c9f0]
Jan 21 21:18:09: | | ASynchronizer.c:104 [64] bytes at [0x55b2f716c9a0]
@corpix
corpix / unbound-1.6.8-to-1.6.7.diff
Last active January 21, 2018 20:09
Difference between 1.6.8 and 1.6.7 versions of unbound where 1.6.7 has https://unbound.net/downloads/patch_cve_2017_15105.diff applied
diff --git a/aclocal.m4 b/aclocal.m4
index 002c472..d1c7555 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.15 -*- Autoconf -*-
-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
@corpix
corpix / example.nix
Last active December 24, 2017 22:26
Simple firewall helper service to open/reject ports for specific interfaces with user defined protocols
let
internalInterfaces = {
enp3s0 = {
ip4 = [
{
address = "10.0.10.1";
prefixLength = 24;
}
];
ip6 = [];
commit 8b6907e3f4de964194bb6069b7053d0e62fe51f3
Author: Dmitry Moskowski <me@corpix.ru>
Date: Sun Dec 10 01:33:47 2017 +0000
Fighting with hakyll to implement a stupid menu
diff --git a/frontend.cabal b/frontend.cabal
index c1bb41f..500ccfa 100644
--- a/frontend.cabal
+++ b/frontend.cabal

Keybase proof

I hereby claim:

  • I am corpix on github.
  • I am corpix (https://keybase.io/corpix) on keybase.
  • I have a public key whose fingerprint is BE24 A859 6D62 D58B 60A2 EEBF 50BE EC20 48B4 DB04

To claim this, I am signing this object:

package main
// XXX: Here will be a bunch of shitcoded solutions :)
import (
"crypto/sha1"
"encoding/base64"
"encoding/hex"
"fmt"
"io"
@corpix
corpix / dockerfile-brew
Last active August 10, 2016 19:25
Tiny script to brew your dockerfile with ease
#!/usr/bin/env python3
import argparse
import json
import os
from os import path
def get_file_content(path):
with open(path, "r") as file:
return file.read()
#!/usr/bin/env bash
set -e
set -x
mkdir recovery
cd recovery
# Iterate installed packages (pkgname=pkgversion)
for pkgfullname in `dpkg -l | grep '^ii' | awk '{print $2"="$3}'`; do
# Get package name without version
{
leaf=$$
ps -eo pid,ppid,command | awk -v leaf="$leaf" \
'{parent[$1]=$2;command[$1]=$3;}
function print_ancestry(pid)
{
print pid " (" command[pid] ") child of " parent[pid];
if(pid!=1) print_ancestry(parent[pid])
};
END{\