Skip to content

Instantly share code, notes, and snippets.

@borisfaure
borisfaure / term_bench.c
Created April 12, 2018 10:09
Benchmark for terminal apps
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#define CLS "\e[2J"
#define COUNT 1000
int w,h,mode;
@marcan
marcan / memopri.py
Last active October 28, 2022 16:47
Casio MemoPri (メモプリ) printer client
#!/usr/bin/python3
import sys, socket, struct
import PIL, PIL.Image, PIL.ImageOps
DENSITY_MIN = 0
DENSITY_LIGHT = 1
DENSITY_NORMAL = 2
DENSITY_HEAVY = 3
DENSITY_MAX = 4
@andyrbell
andyrbell / scanner.sh
Last active April 5, 2024 09:01
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@mcastelino
mcastelino / qemu_vhost.md
Last active February 23, 2024 08:59
QEMU Tips and Tricks

How to launch QEMU from command line without libvirt with macvtap and vhost support

This sets up a host local bridge with a macvlan interface for VM to host communication. The macvtap is setup with vhost support.

The command line options to note are

-netdev tap,fd=3,id=hostnet0,vhost=on,vhostfd=4 3<>$"$tapdev" 4<>/dev/vhost-net -device virtio-net-pci,netdev=hostnet0,id=net0,mac=$(< /sys/class/net/testtap/address)

This sets up two different fd's. The first for macvtap and the second for vhost-net.

MEMPTR, esoteric register of the ZiLOG Z80 CPU.
by Boo-boo (first and draft English translation by Vladimir Kladov)
As it is known, after the instruction BIT n,(HL) execution, bits 3 and 5 of the flag register become containing values that is not documented in the official documentation at all. Actually these bits are copied from the bits 11 and 13 of the internal register pair of Z80 CPU, which is used for 16-bit operations, and in most cases to handle addresses. This is usual practice for processors having 8-bits data bus working with 16-bits data.
It is not known why and how these bits of the internal buffer register are copied to the flags register though. At least Sean Young in the "Undocumented Z80 Documented" refers to that phenomenon (http://www.myquest.nl/z80undocumented/) and a bit more info can be found in the Z80 description of another "nocash" project (http://www.work.de/nocash/zxdocs.htm) where such register pair is called as MEMPTR. Unfortunately until now attemts to crack the algorithm se
@mklabs
mklabs / bootstrap-plugins.txt
Created December 2, 2011 11:23
h5bp + twitter bootstrap integration
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-alert.js
bootstrap-button.js
bootstrap-carousel.js
bootstrap-collapse.js
bootstrap-dropdown.js
bootstrap-modal.js
bootstrap-scrollspy.js
bootstrap-tab.js
@anisse
anisse / 0001-Rebuild-for-squeeze-backports.patch
Created August 17, 2011 14:25
Mesa 7.11 squeeze backport
From d4d70b3eb3779255836695afa5cedf49d21b1c48 Mon Sep 17 00:00:00 2001
From: Anisse Astier <anisse@astier.eu>
Date: Wed, 17 Aug 2011 11:35:19 +0200
Subject: [PATCH 1/8] Rebuild for squeeze-backports
---
debian/changelog | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/debian/changelog b/debian/changelog