Skip to content

Instantly share code, notes, and snippets.

View debugloop's full-sized avatar
👻
dealing with cursed scripture

Daniel Nägele debugloop

👻
dealing with cursed scripture
View GitHub Profile
@claymcleod
claymcleod / pycurses.py
Last active March 25, 2024 18:30
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@paniq
paniq / minmaxabssign.txt
Last active January 30, 2023 14:31
useful min/max/abs/sign identities
max(-x,-y) = -min(x,y)
min(-x,-y) = -max(x,y)
abs(x) = abs(-x)
abs(x) = max(x,-x) = -min(x,-x)
abs(x*a) = if (a >= 0) abs(x)*a
(a < 0) -abs(x)*a
// basically any commutative operation
min(x,y) + max(x,y) = x + y
@debugloop
debugloop / bootable-thumbdrive.md
Last active August 29, 2015 14:12
Howto make a USB Key bootable, with multiple images and with no fancy tools
  1. Format the stick with FAT32, mount and go to the mountpoint (./ refers to your mountpoint)
  2. Create your grub.cfg (example below) in ./boot/grub/grub.cfg
  3. sudo grub-install --no-floppy --boot-directory=./boot /dev/sdx (use the right device, duh)
  4. Test it with sudo qemu-system-x86_64 -m 512 /dev/sdx

This will show you your menu, but obviously nothing will boot. Create ./iso (or whatever you called it in your grub.cfg) and dump some images into it. The exact versions will not matter (get the paths right), but the distribution most probably will. The grub.cfg below includes the kernel lines GRUB needs to boot Debian, Ubuntu or Archlinux Installers as well as the GRML Live System from http://grml.org/. These are the ones I need, if you want some more/others try the comments below this gist or have fun picking together working GRUB kernel line magic :)

PS: Beware a long-standing bug in the Debian-Installer which causes the bootloader to be written to /dev/sda, which i

@Zulko
Zulko / soccer_cuts.py
Last active December 22, 2023 05:59
A python script to automatically summarize soccer videos based on the crowd's reactions
#
# This Python script makes a summary of a football game by cutting
# the video around the 10 % loudest moments, which generally
# include the goals and other important events.
# For more details, see this blog post:
# http://zulko.github.io/blog/2014/07/04/automatic-soccer-highlights-compilations-with-python/
#
# LICENCE: Creative Commons 0 - Public Domain
# I, the author of this script, wave any rights and place this work in the public domain.
#
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
__all__ = ["transform"]
__version__ = '0.3'
__author__ = 'Christoph Burgmer <cburgmer@ira.uka.de>'
__url__ = 'http://github.com/cburgmer/upsidedown'
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active February 25, 2024 13:47
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@ungoldman
ungoldman / dokku_setup.md
Last active November 28, 2023 12:35
Deploy your own PaaS: Setting up Dokku with DigitalOcean and Namecheap

Deploy your own PaaS!

Setting up Dokku with DigitalOcean and Namecheap

..or how I made my own heroku in a few hours for $3.98.


This write-up is several years out of date! You probably shouldn't use it.

@aguslr
aguslr / README.md
Last active December 20, 2015 00:19
Grub2 loopback multiboot pen drive to boot from ISO
@willurd
willurd / web-servers.md
Last active March 29, 2024 02:15
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@mislav
mislav / _readme.md
Last active March 28, 2024 00:47
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work: