Skip to content

Instantly share code, notes, and snippets.

@ianmetcalf
ianmetcalf / mithril-debounce.js
Last active February 4, 2016 19:54
Delay redraw for debounced events,based on https://www.npmjs.com/package/debounce
import m from 'mithril';
import now from 'date-now';
export default function debounce(func, wait = 100, immediate = false) {
let context, args, timestamp, timeout, result;
function debounced() {
context = this;
args = arguments;
timestamp = now();
@undefinedbehavior
undefinedbehavior / rpi3_rust_led.rs
Last active January 17, 2017 06:47
Rust demo for Pi 3 bare metal
#![feature(asm)]
#![feature(lang_items)]
#![crate_type = "staticlib"]
#![no_std]
const GPIO_BASE: u32 = 0x3F200000; // base address for Pi 2 and Pi 3
fn sleep(value: u32){
for _ in 1..value {
unsafe { asm!("");}
@mbostock
mbostock / .block
Last active March 10, 2019 08:11 — forked from mbostock/.block
The Sun’s View of the Earth
license: gpl-3.0
redirect: https://observablehq.com/@mbostock/the-suns-view-of-the-earth
@Anomitee
Anomitee / Multiple_PA_Streams.md
Last active March 4, 2022 22:09
Instructions on how to record multiple audio streams in SimpleScreenRecorder of only the applications you want such that they are separable when editing.

Suppose you want to record 3 things: your microphone, game and Mumble. With multiple audio stream support, you can record what's in the input tab of pavucontrol (which contains the mic channel, and a monitor of your computer's sounds). Problem is, as you stated, is that recording the monitor input will grab every application (not good, for example, if you want to keep Skype open to catch any calls but not record it). This also mashes together all the audio meaning you won't be able to edit the game audio and Mumble separately.

What you can do, is run the command pactl load-module module-null-sink sink_name=game_out This will create an output named "Null Output" in the output tab. Using pavucontrol, you can send the output of your game to the "Null Ouput", but you'll lose the sound. Running pactl load-module module-loopback source=app_out.monitor, however, will loop the Null Ouput back into the original output of the game, meaning you'll be able to hear your game again, but there will be a new input recor

@StephanHoyer
StephanHoyer / gist:bddccd9e159828867d2a
Last active March 29, 2022 11:46
Isomorphic applications with mithril

Attention

This post described how to create an application with mithril 0.2.x. Now that ver 1.0 is out, some things are a little differnent.

The example is updated with the current version of mithril, though.

Isomorphic applications with mithril

@ynsta
ynsta / blur.sh
Last active September 28, 2022 18:26
Blur konsole and yakuake instead of simple transparency
# add to zshrc
function blur-konsoles() {
windows=($(qdbus org.kde.konsole 2>/dev/null | egrep '^\/konsole\/MainWindow_[0-9]+$'))
for win in ${windows}; do
winId=$(qdbus org.kde.konsole $win winId 2>/dev/null)
[ ! -z "${winId}" ] && xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id "${winId}"
done
qdbus org.kde.yakuake &>/dev/null && xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -name Yakuake
}
[ ! -z "$KONSOLE_DBUS_WINDOW" ] && blur-konsoles
@adaptivegarage
adaptivegarage / theme-detect.css
Last active January 17, 2023 06:04
Pure CSS ePub theme detection (White / Sepia / Night) in iBooks (Mac OS and iOS included)
/*
Pure CSS ePub theme detection (White / Sepia / Night) in iBooks (Mac OS and iOS included)
Version 1.1
Note that iBooks actually uses internal JavaScript to set the "__ibooks_internal_theme" attribute on :root (html) element
every time the theme is changed, but this happens independently of whether your epub html markup is scripted or not.
Discovered and tested in iBooks on Mac, iPhone and iPad by
https://twitter.com/adaptivegarage
*/
@mieki256
mieki256 / yliluoma_ordered_dither.py
Last active January 29, 2023 08:28
Yliluoma's ordered dithering algorithm 1, 2, 3. Python version.
#!python
# -*- mode: python; Encoding: utf-8; coding: utf-8 -*-
# Last updated: <2022/07/13 01:32:08 +0900>
"""
Yliluoma's ordered dithering algorithm 1, 2, 3 and adobe like
Arbitrary-palette positional dithering algorithm
https://bisqwit.iki.fi/story/howto/dither/jy/
Usage:
#!/bin/bash
# export DBUS_SESSION_BUS_ADDRESS environment variable because cron hates me
PID=$(pgrep -u USER gnome-session-b)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)
/usr/bin/gsettings set org.gnome.shell.extensions.user-theme name 'Flat-Plat'
/usr/bin/gsettings set org.gnome.desktop.interface gtk-theme 'Flat-Plat'
/usr/bin/gsettings set org.gnome.desktop.background picture-uri 'file://WALLPAPER-PATH'
/usr/bin/gsettings --schemadir ~/.local/share/gnome-shell/extensions/drop-down-terminal@gs-extensions.zzrough.org set org.zzrough.gs-extensions.drop-down-terminal background-color 'rgb(69,90,100)'