Skip to content

Instantly share code, notes, and snippets.

View Kilobyte22's full-sized avatar

Stephan Henrichs Kilobyte22

View GitHub Profile
CREATE MATERIALIZED VIEW haproxy.access_logs_view
(
remote_addr String,
remote_port Int32,
ts DateTime,
frontend LowCardinality(String),
tls Boolean,
backend LowCardinality(String),
server LowCardinality(String),
time_request Int32,
#!/usr/bin/env ruby
require 'json'
require 'yaml'
require 'net/http'
KIBI = 1024
MEBI = KIBI * 1024
GIBI = MEBI * 1024
default partial alphanumeric_keys
xkb_symbols "basic" {
include "gb"
include "level3(caps_switch)"
name[Group1] = "English (UK, international with German umlaut)";
key <AD03> { [ e, E, EuroSign, cent ] };
key <AD07> { [ u, U, udiaeresis, Udiaeresis ] };
key <AD09> { [ o, O, odiaeresis, Odiaeresis ] };
key <AC01> { [ a, A, adiaeresis, Adiaeresis ] };
key <AC02> { [ s, S, ssharp ] };
package at.chaosfield.packupdate.common
import scala.util.parsing.combinator._
class BasicAuthParser extends RegexParsers {
// A RegexParsers automatically ignores whitespace by default.
// Technically this means this parser accepts inputs it shouldn't, but i don't really care
// A single token according to RFC2616
def token: Parser[String] = """[^()<>@,;:\\"/\[\]?={} \t]+""".r ^^ { _.toString }
@Kilobyte22
Kilobyte22 / core.rs
Last active August 4, 2017 22:11
Proof of Concept Plugin system for rust
extern crate libloading as lib;
extern crate libplugin as plugin;
use plugin::Plugin;
fn main() {
let lib = lib::Library::new("plugins/libtestplugin.so").unwrap();
unsafe {
let func: lib::Symbol<unsafe fn() -> Box<Plugin>> = lib.get(b"gimme_pluginz\0").unwrap();
let plugin: Box<Plugin> = func();
#!/bin/bash
title=$(dmenu -p 'password title: ' < /dev/null)
if [[ "$title" != "" ]]; then
if [[ -f ~/.password-store/"$title".gpg ]]; then
ans=$(echo -e 'no\nyes' | dmenu -p 'answer: ' -mesg 'Password exists, do you want to overwrite?' -only-match)
if [[ "$ans" == yes ]]; then
pass generate -f -c "$title" 30 && \
notify-send "Password Store" "Password generated"

Keybase proof

I hereby claim:

  • I am kilobyte22 on github.
  • I am kilobyte (https://keybase.io/kilobyte) on keybase.
  • I have a public key whose fingerprint is 2F75 B61F 7F77 B92D 507C 07FC B3AC 4F40 BC39 6055

To claim this, I am signing this object:

@Kilobyte22
Kilobyte22 / ping.pl
Last active December 11, 2015 11:51
#!/bin/perl
# i3blocks script to display current ping
# Licensed under the MIT license
use strict;
use warnings;
sub ping {
my $host = shift;
1. You lose the game by thinking about it
2. When you lose the game you have to publically announce it making everyone around you lose it as well
3. After losing the game you have 30 minutes to forget it again
4. By knowing these rules you are automatically participating
Congratulations, you just lost the game
#include "stdio.h"
#include "stdlib.h"
#include "unistd.h"
void usage() {
printf("Usage: environment command [arguments]\n");
exit(1);
}
int main(int argc, char **argv) {