Skip to content

Instantly share code, notes, and snippets.

@lisael
lisael / fiboperf.zig
Created May 10, 2022 21:31
fibonacciIter is not even optimized...
const std = @import("std");
const time = std.time;
pub fn main() anyerror!void {
const fibo_arg = 30;
var start = time.nanoTimestamp();
var end = time.nanoTimestamp();
std.debug.print("noop - {}ns\n", .{end - start});
start = time.nanoTimestamp();
var result = fibonacciRecurse(fibo_arg);
@lisael
lisael / boostrap.sh
Created February 3, 2022 15:12
sxmo-git archlinux install
#!/bin/sh
use std::fmt;
use druid::im::Vector;
use druid::widget::{Button, Either, Flex, Label, Scroll, TextBox};
use druid::{AppLauncher, Data, Lens, LocalizedString, Widget, WidgetExt, WindowDesc};
use druid_widget_nursery::{Tree, TreeNode};
#[derive(Clone, Lens, Data)]
struct Taxonomy {
name: String,
@lisael
lisael / main.rs
Created June 22, 2021 21:40
rusql stuff
use rusqlite::{params, Connection, Result};
use serde_derive::{Deserialize, Serialize};
use serde_rusqlite::*;
use std::fs::File;
#[derive(Debug, Deserialize, Serialize)]
struct TodoItem {
id: Option<i32>,
content: String,
done: bool,
declare-option str-list quickbufs
define-command -override quickbuf %{
eval %sh{
rm /tmp/buflist
rm /tmp/buflist_tmp
for bufname in $kak_opt_quickbufs $kak_buflist
do printf "%s\n" "$bufname" >> /tmp/buflist_tmp
done
cat /tmp/buflist_tmp | awk '!seen[$0]++' | grep -v "/tmp/buflist" > /tmp/buflist
@lisael
lisael / xmonad.hs
Last active September 27, 2017 09:56
inputMode :: [( (KeyMask, KeySym), (X () ) )] -> X ()
inputMode xs = do
submap . M.fromList $ modeMap where
modeMap = [ ( ( km, ks ), do x
(submap . M.fromList $ modeMap) )
| ( ( km, ks ), x ) <- xs
] ++ [((0, xK_Escape), return ())]
moveMode =
@lisael
lisael / rofistuff.sh
Created September 21, 2017 14:55
some quick and dirty rofi scripts...
add(){
GIT_DIR=$(dirname $(realpath -s $(git rev-parse --git-dir)))
if [ "$GIT_DIR" != "" ]; then
for file in $( git status --porcelain \
| awk -v GIT_DIR=$GIT_DIR '{print $1 " " GIT_DIR "/" $2 }' \
| awk '{"realpath -s --relative-to . " $2 | getline path; print $1 " " path}' \
| rofi -dmenu -sync -i -font "mono 6" -p 'git add:' \
-scroll-method 1 -lines 30 -matching glob \
-hide-scrollbar -line-margin 0 -multi-select \
| awk '{print $2}'); do
@lisael
lisael / Tree.elm
Created September 12, 2017 01:29
strange compilator error...
type alias Item a = { a | id: Int, path: List Int }
type Tree a
= Empty
| Node (Item a) (List (Tree a))
insert_: Item a -> Tree a -> Tree a
insert_ item tree =
case tree of
@lisael
lisael / sort.py
Created September 24, 2013 20:40
import sys
import re
INPUT_FILE = sys.argv[1]
with open(INPUT_FILE) as inf:
origs_lines = inf.readlines()
lines = []
"""
read lz4 compressed files and print them on stdout
shell globs allowed
"""
import sys
import glob
import argparse