Skip to content

Instantly share code, notes, and snippets.

View levex's full-sized avatar
🌄
Chasing sunsets while working remotely

Levente Kurusa levex

🌄
Chasing sunsets while working remotely
View GitHub Profile
@levex
levex / elixir.nix
Created April 5, 2023 17:18
Custom Nix Shell with specific Erlang and Elixir
{ sources ? import ./sources.nix, pkgs ? import sources.nixpkgs { } }:
with pkgs;
let
erlang = pkgs.erlang.override {
version = "26.0-rc2";
sha256 = "1xqzdqniv6af7cajd3agnqdi12n4fy644p8z07k7r24cp1lz7y03";
};
@levex
levex / send_after_wrapper.ex
Created March 15, 2023 14:23
Wrap Process.send_after/4 to record TimerRef's
defmodule SendAfter do
@moduledoc """
Simple assistance wrapper for SendAfter calls to record the TimerRef's.
Idea is then to use this data to display an internal page, in order to verify whether
our GenServers run as intended.
"""
@doc """
Wrap Process.send_after/4 to ensure that we can record timer data.
@levex
levex / feedlist.opml
Last active September 30, 2018 09:39
My blog subscriptions
<?xml version="1.0"?>
<opml version="1.0">
<head>
<title>newsboat - Exported Feeds</title>
</head>
<body>
<outline type="rss" xmlUrl="http://comonad.com/reader/feed/" htmlUrl="http://comonad.com/reader" title="The Comonad.Reader"/>
<outline type="rss" xmlUrl="http://www.haskellforall.com/feeds/posts/default" htmlUrl="http://www.haskellforall.com/" title="Haskell for all"/>
<outline type="rss" xmlUrl="http://blog.sigfpe.com/feeds/posts/default" htmlUrl="http://blog.sigfpe.com/" title="A Neighborhood of Infinity"/>
<outline type="rss" xmlUrl="https://www.fpcomplete.com/blog/rss.xml" htmlUrl="https://www.fpcomplete.com/blog" title="Blog"/>
$ build/x86_64-unknown-linux-gnu/stage1/bin/rustc -vV
rustc 1.30.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.30.0-dev
LLVM version: 8.0
@levex
levex / Makefile
Created September 10, 2018 16:46
HiFive1 barebones OSdev
SDK=/home/lkurusa/dev/freedom-e-sdk
SDK_PREFIX=$(SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin
CROSS=$(SDK_PREFIX)/riscv64-unknown-elf-
CFLAGS=-g \
-march=rv32imac \
-mabi=ilp32 \
-mcmodel=medany
LINKER_SCRIPT=hifive1.lds
@levex
levex / ssh-check-username.py
Created August 16, 2018 12:25
779974d35b4859c07bc3cb8a12c74b43b0a7d1e0
#!/usr/bin/env python
# Copyright (c) 2018 Matthew Daley
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@levex
levex / args.c
Created August 15, 2018 07:32
Processing arguments in C
char *s;
while (--argc > 0 && (*++argv)[0] == '-')
for(s = argv[0]+1; *s != '\0'; s++)
switch(*s) {
case 'x':
/* Set appropriate flags for 'x' option */
break;
case 'n':
/* Set appropriate flags for 'n' option */
break;
@levex
levex / extract_page_one_to_jpg.sh
Last active August 13, 2018 13:11
Convert a PDF's first page to JPG on Fedora
#!/bin/bash
WHAT=$1
WHERE=$2
[[ -z $WHAT ]] && echo Usage: $0 \<what\> \<to-where\> && exit 1
[[ -z $WHERE ]] && echo Usage: $0 \<what\> \<to-where\> && exit
_TMPFILE=$(mktemp)
@levex
levex / rc.lua
Created August 12, 2018 17:42
Open manpages from Awesome
--
--
-- efine these functions somewhere in your rc.lua or utils.lua
--
--
function l_split(str, pat)
local t = {} -- NOTE: use {n = 0} in Lua-5.0
local fpat = "(.-)" .. pat
local last_end = 1
@levex
levex / refcell.rs
Created August 9, 2018 10:13
RefCell madness
use std::cell::RefCell;
const x: RefCell<bool> = RefCell::new(false);
fn main() {
let _x = x.borrow();
if _x.clone() {
println!("True");
} else {