Skip to content

Instantly share code, notes, and snippets.

View benaryorg's full-sized avatar

Katze benaryorg

View GitHub Profile
@benaryorg
benaryorg / unlink-dir.c
Created July 17, 2020 01:24
figuring out some things regarding directories
#include <stdio.h>
union fi
{
unsigned i;
float f;
};
int main(void)
{
@benaryorg
benaryorg / keybase.md
Created December 26, 2018 20:04
keybase

Keybase proof

I hereby claim:

  • I am benaryorg on github.
  • I am katze (https://keybase.io/katze) on keybase.
  • I have a public key whose fingerprint is 6668 5437 4A5D 8843 7FA4 6B44 7A06 724E 5B00 E546

To claim this, I am signing this object:

@benaryorg
benaryorg / discard.c
Last active September 27, 2018 13:30
// somewhat performant discard service I guess.
// listens on localhost:1337 (it's not port 9 since I prefer non-priv users)
//
// compile with something like that:
// clang -Wall -Wextra -Werror -pedantic -std=c11 -O2 -o discard discard.c
#include <err.h>
#include <fcntl.h>
#include <netdb.h>
#include <stdlib.h>
#!/usr/bin/env vim
option=value
use std::io::BufRead;
use std::io::BufReader;
use std::io::Write;
use std::net::Ipv4Addr;
use std::net::TcpListener;
use std::net::TcpStream;
fn main() -> std::io::Result<()>
{
let listen = try!(TcpListener::bind(("::",1337)));
#!/usr/bin/env zsh
curl -sf https://me.benary.org \
| jq -f <(tail -n +$(( ${LINENO} + 2 )) ${(%):-%N})
exit
# BEGIN JQ SCRIPT
"\(.me.name[0]) (\(.me.pronoun))"
@benaryorg
benaryorg / voip.sh
Last active May 5, 2018 14:40
voip
#!/usr/bin/env zsh
# you can then forward the port pretty well using ssh -NR
# port to listen on
port=1337
###
#
# print error to stderr and return negative error code for chaining
#!/usr/bin/env zsh
artist="${1?}"
title="${2?}"
album="${3?}"
awesome-client <<END
naughty = require("naughty")
naughty.notify({title="MoC",text=$(jq -R . <<<"#np ${artist} – ${title} (${album})")})
END
extern crate regex;
use std::env;
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
use std::time::Instant;
use regex::Regex;