Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
"""Yet another curses-based directory tree browser, in Python.
I thought I could use something like this for filename entry, kind of
like the old 4DOS 'select' command --- cd $(cursoutline.py). So you
navigate and hit Enter, and it exits and spits out the file you're on.
Originally from: http://lists.canonical.org/pipermail/kragen-hacks/2005-December/000424.html
Originally by: Kragen Sitaker
@robmint
robmint / gist:4753401
Last active May 18, 2020 10:48
Basic linux framebuffer graphics setup
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <stdbool.h>
#include <linux/input.h>
@seanf
seanf / 81-thinkpad-dock.rules
Last active March 20, 2023 10:42
Example ThinkPad docking script for multi-monitor
# Save this file (after modifying ID_VENDOR and ID_MODEL if necessary) as /etc/udev/rules.d/81-thinkpad-dock.rules
# These values seem to work for "ThinkPad Mini Dock Plus Series 3"
SUBSYSTEM=="usb", ACTION=="add|remove", ENV{ID_VENDOR}=="17ef", ENV{ID_MODEL}=="100a", RUN+="/etc/sbin/thinkpad-dock.sh"
@adamnew123456
adamnew123456 / arithmetic.py
Last active February 11, 2024 15:49
Pratt Parser For Arithmetic Expressions
"""
This implements a fairly simple expression language via a Pratt-style parser.
The language supports fairly standard floating point literals, such as:
5
1.09
.16
12e7
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@cdleon
cdleon / macbook-pro-2011-defective-gpu-fix.md
Last active February 15, 2024 10:24
Macbook Pro 2011 GPU Defect fix macOS Sierra and High Sierra
@volgorean
volgorean / app.js
Created December 3, 2017 08:08
Example vue.js app setup without webpack
new Vue({
el: "#app",
new Router({
mode: "history",
routes: [
{ path: "/", component: httpVueLoader("components/dash.vue") }
]
})
});
@theinternetftw
theinternetftw / block-5-phone-presser.md
Last active January 6, 2023 17:11
Block 5 Phone Presser

Block 5 Phone Presser

2018-05-10

James Gleeson, SpaceX PR: Quick thank you to everyone for joining us on today's call. We're just a little over two hours from the launch of the Bangabandhu satellite's mission and the first flight of Falcon 9 Block 5. We have about 30 minutes for today's call to discuss the upgrades made to the Falcon 9 launch vehicle, and we'd like to get through as many of your questions as possible in that time. So to keep the conversation flowing, please limit your

@JMalysiak
JMalysiak / facetags.py
Last active March 8, 2024 09:12
Import Picasa face tags into Digikam database
# This is a script to import face tags from Picasa into Digikam's SQLite database.
# First you need to export Picasa database into XML using this tool:
# https://sourceforge.net/projects/exportpicasa/
# Later you need to adjust this script to fit your needs and then just run it.
import xml.etree.ElementTree as ET
import sqlite3
# Adjust the values below:
XML_FILE_PATH = '/path/to/file.xml'
@munificent
munificent / generate.c
Last active May 14, 2024 05:30
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u