Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
#
# This file is part of cannelloni, a SocketCAN over Ethernet tunnel.
#
# Copyright (C) 2014-2015 Maximilian Güntner <[email protected]>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2 as
# published by the Free Software Foundation.
#
require 'json'
file = File.read("chains.json")
data = JSON.parse(file)
unknowncount = 0
for effect in data
filename = ""
for element in effect
if element.class == String
@mguentner
mguentner / configuration.nix
Created April 15, 2016 16:34
config / test environment for mysql nix issue / long_init_db.sql stolen from http://stackoverflow.com/questions/5125096/for-loop-example-in-mysql#5126655
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@mguentner
mguentner / concurrentadd.go
Last active August 16, 2017 14:18
Minimal test case for IPFS concurrent add
// run with ./concurrentadd --dir where/your/testfiles/reside
package main
import (
"flag"
"log"
"os"
"io/ioutil"
"github.com/ipfs/go-ipfs-api"
"path/filepath"
@mguentner
mguentner / pure.nix
Created August 20, 2017 20:43
nix config for anonymous ftp with pure-ftpd
{
systemd.services.pure-ftpd = {
description = "PureFTPD Server";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
# -e only Anon -M allow Dirs
ExecStart = "${pkgs.pure-ftpd}/bin/pure-ftpd -e -M -p 30000:50000";
Type = "simple";
};
};
@mguentner
mguentner / unicorn.nix
Last active September 3, 2017 01:23
Unicorn config for rails
{ workingDirectory, socketLocation, pidLocation, workerProcesses }:
let
cfg = ''
# The following was taken from github.com/crohr/syslogger and is BSD
# licensed.
require 'syslog'
require 'logger'
require 'thread'
class Syslogger
@mguentner
mguentner / config.nix
Created September 5, 2017 15:38
Alacritty with scrollback support -> https://github.com/jwilm/alacritty/pull/657
{
alacritty_sb = callPackage ./alacritty {
inherit (pkgs.xorg) libXcursor libXxf86vm libXi libX11;
};
}
@mguentner
mguentner / gist:c975c0d1aa12b1c6a846d615fb292484
Created January 30, 2018 16:05
absolute div under <html>
<html>
<title>Absolute answers are hard.</title>
<style>
#main {
background-color: #00ff00;
height: 200px;
}
#absolute {
position: absolute;
top: 220px;
#!/usr/bin/env ruby
require 'byebug'
require 'dry-validation'
module MyPredicates
include Dry::Logic::Predicates
predicate(:nested_one?) do |value|
(value.is_a? Hash) && value.key?(:alpha)
@mguentner
mguentner / example_i3.config
Created October 25, 2018 12:33
a script that kills either tmux or the respective focused window. For use with i3 or other window managers
bindsym --release $mod+q exec --no-startup-id /home/anon/bin/kill.sh