This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import re | |
INPUT_FILE = sys.argv[1] | |
with open(INPUT_FILE) as inf: | |
origs_lines = inf.readlines() | |
lines = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
read lz4 compressed files and print them on stdout | |
shell globs allowed | |
""" | |
import sys | |
import glob | |
import argparse |