Skip to content

Instantly share code, notes, and snippets.

@FractalWire
FractalWire / fexp3
Last active November 8, 2019 06:16
The moving fuzzy file explorer powered by fzf
#!/bin/bash
# A simple script to make fzf a fuzzy-file explorer
# After the program exits, it should be cleared with tput rmcup, otherwise the
# terminal stays in alternate screen mode
old_folder=$(pwd)
cur_folder="$old_folder"
tree_depth=1
while true
do
@FractalWire
FractalWire / fexp2
Created September 26, 2019 18:30
The moving fuzzy file explorer powered by fzf
#!/bin/bash
# A simple script to make fzf a fuzzy-file explorer
old_folder=$(pwd)
cur_folder="$old_folder"
while true
do
ret=$(fd -t d --color=always \
| fzf --no-height \
--bind 'ctrl-h:abort+execute(echo "ACTION=LEFT")','ctrl-l:abort+execute(echo "ACTION=RIGHT" {})','alt-enter:abort+execute(echo "ACTION=EXIT" {})' \
@FractalWire
FractalWire / fexp
Created September 26, 2019 12:21
The fuzzy file explorer powered by fzf
#!/bin/bash
# A simple script to make fzf a fuzzy-file explorer
cur_folder=$(pwd)
while true
do
folder=$( ( echo -e '.\n..'; fd -t d --color=always ) \
| fzf --no-height --preview-window=right:50% \
--preview 'tree -L 2 -C {}')
test $? -ne 0 && break
@FractalWire
FractalWire / nvrp
Last active September 5, 2020 03:32
preview file with fzf and nvr
#!/bin/bash
# simple script to preview files with the help of fzf
cwd=$(pwd)
# set up
nvr --nostart -cc 'let nvrp_buffer=""'
set_variables='mime_list=( "application/json" "text/" ); mime=$(file --mime-type {} | cut -d " " -f 2)'
f_is_text='for m in ${mime_list[@]}; do test "${mime#$m}" != "$mime" && break || false; done'
CREATE TABLE purchases_more (
id serial
, customer_id int -- REFERENCES customer
, total int -- could be amount of money in Cent
, some_column text -- to make the row bigger, more realistic
);
INSERT INTO purchases_more (customer_id, total, some_column) -- insert 8M rows
SELECT (random() * 40000)::int AS customer_id -- 40k customers
import tcod
import tcod.event
def main():
width = 60
height = 40
font = "data/fonts/dejavu16x16_gs_tc.png"
flag = tcod.FONT_LAYOUT_TCOD | tcod.FONT_TYPE_GREYSCALE
tcod.console_set_custom_font(font, flag)
@FractalWire
FractalWire / wall.py
Last active February 10, 2021 00:44
get the value of a wall
from math import cos, sin, pi
from enum import IntFlag
import numpy as np
# OUTPUT :
#
# Walkable space :
# [[ True True True True True]
# [ True False False False True]
# [ True False False False True]
@FractalWire
FractalWire / char_gen.txt
Created March 3, 2019 20:36
Character generation for 7DRL
Character Aurora Li is a 28 y.o. Female:
Was born WITHOUT CONVICTIONS, but CONSERVATIVE was his/her true nature
Profession: Civilian
He/She has 458 juice and is therefore considered an Urban Commando by society.
Attributes:
hp=4
heart=1
wisdom=4
intel=9
strength=4
@FractalWire
FractalWire / map_chunker3.py
Created February 7, 2019 15:39
A map generator for roguelike a bit optimized
import curses
import numpy as np
import random
from enum import IntEnum
from typing import Any, List, Tuple, Callable
import time
import profile
MAP_WIDTH = 100
MAP_HEIGHT = 100
@FractalWire
FractalWire / map_chunker2.py
Last active February 5, 2019 22:36
A map generator for roguelike games with corridors
import curses
import numpy as np
import random
from enum import Enum
from typing import Any, List, Tuple, Callable
import time
MAP_WIDTH = 80
MAP_HEIGHT = 25