Skip to content

Instantly share code, notes, and snippets.

View woky's full-sized avatar

woky

View GitHub Profile
@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: deekayen@WINDOMAIN.COM
ansible_user: deekayen
tasks:
@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):
@dcommander
dcommander / Makefile
Last active April 2, 2024 10:12
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
@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.

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

@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)
@dankrause
dankrause / custom-tinycore.sh
Last active April 13, 2024 10:50
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