Skip to content

Instantly share code, notes, and snippets.

View woky's full-sized avatar

woky

View GitHub Profile
@dankrause
dankrause / custom-tinycore.sh
Last active February 9, 2025 03:08
Create a custom tinycore linux iso. Adjust the config at the beginning of the script, or supply a conf as the first arg. Requires xorriso.
#!/bin/bash
set -e
function cleanup() {
# clean up our temp folder
rm -rf "${TMPDIR}"
}
trap cleanup EXIT
@aisamanra
aisamanra / jsonfs.hs
Created November 13, 2014 07:17
Quick-and-dirty program to mount JSON as a read-only file system
{-# LANGUAGE OverloadedStrings #-}
-- WARNING! This is very bad, quickly-written code, and should not be
-- trusted to do anything right! It does not support writing, and still
-- has several problems even for reading. Also it's ugly and bad.
import qualified Data.ByteString as BSS
import Data.ByteString.Lazy (ByteString)
import qualified Data.ByteString.Lazy as BS
import Data.Char (isDigit)

Debian Kernel Hooks

Recently I setup my work laptop to dual boot Arch Linux and Ubuntu server with syslinux as my bootloader. I setup the laptop with a dedicated /boot partition that would be shared between the two operating systems. I added this boot entry to /boot/syslinux/syslinux.cfg.

LABEL ubuntu
    MENU LABEL Ubuntu 
    LINUX ../vmlinuz-3.8.0-29-generic
    APPEND root=LABEL=UBUNTU rw

INITRD ../initrd.img-3.8.0-29-generic

@martinth
martinth / argparse_fileinput_demo.py
Created August 6, 2015 11:04
Read from stdin or files in Python (combining argparse and fileinput)
import argpase
import fileinput
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('--dummy', help='dummy argument')
parser.add_argument('files', metavar='FILE', nargs='*', help='files to read, if empty, stdin is used')
args = parser.parse_args()
# If you would call fileinput.input() without files it would try to process all arguments.
@dcommander
dcommander / Makefile
Last active March 27, 2025 16:47
Simple program to demonstrate OpenGL rendering without an X server
all: egltest
egltest: egltest.c
cc -O3 -Wall -Werror -I. -o $@ $^ -lOpenGL -lEGL
clean:
rm -f *.o egltest
@dgreyling
dgreyling / flask-login-example
Created November 11, 2016 23:23 — forked from benjiao/flask-login-example
Flask Login Example
from flask import session
from flask import request
from flask import redirect
from functools import wraps
app = Flask(__name__)
app.secret_key = '86A611287CE4DC76545575687F84F'
def login_required(test):
@deekayen
deekayen / substr.yml
Created March 21, 2018 17:45
Ansible variable substring from regex_replace
---
# RUN: ansible-playbook -i localhost, substr.yml
- hosts: localhost
vars:
stuff: [email protected]
ansible_user: deekayen
tasks: