Skip to content

Instantly share code, notes, and snippets.

View MetroWind's full-sized avatar
🐱
Setting status…

Metro Wind MetroWind

🐱
Setting status…
View GitHub Profile
@MetroWind
MetroWind / start.sh
Created March 17, 2016 02:53
Raspberry Pi video streaming
#!/usr/bin/env bash
Width=1296
Height=972
Fps=15
Bitrate=2000 # In Kb/s
BitrateRaw=$((${Bitrate} * 1024))
raspivid -t 0 -w ${Width} -h ${Height} -b ${BitrateRaw} -fps ${Fps} -ih -n -o - | \
cvlc stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264
@MetroWind
MetroWind / test.py
Last active December 7, 2016 00:55
Emacs python-mode docstring fill bug. Emacs fills the 1st line of a docstring incorrectly. The fill width is counted from the """, where for the rest of the lines, the fill is counted from the beginning of the line. See bugs https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20860 and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21254
# -*- fill-column: 40; -*-
def f():
"""a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a
a a a a a
"""
def f():
"""a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a
a a a a a a a
@MetroWind
MetroWind / halftone.pde
Created January 20, 2017 02:32
Processing program to generate "halftone" pattern.
void setup() {
size(4096, 2048);
// The background image must be the same size as the parameters
// into the size() method. In this program, the size of the image
// is 640 x 360 pixels.
background(0);
noStroke();
noLoop();
}
@MetroWind
MetroWind / convert.sh
Last active October 13, 2021 09:19
High-pass filter + binarize in Imagemagick
# convert -bias 50% -morphology Convolve DoG:0,0,10 -threshold 40% source.png result.png
convert input.jpg \( -clone 0 -blur 0x100 \) \( -clone 0 -clone 1 +swap -compose mathematics -set option:compose:args "0,1,-1,0.5" -composite \) -delete 0,1 -threshold 40% result.png
@MetroWind
MetroWind / geekhack.css
Created July 11, 2017 21:20
Geekhack eye protector
body
{
font-family: "Avenir Next", sans-serif;
}
div#wrapper
{
max-width: 1024px;
}
@MetroWind
MetroWind / .emacs.el
Last active October 13, 2017 00:13
Maximize/restore Emacs window.
;; Maximize and restore window.
(defvar window-confs (make-hash-table))
;; window-confs is equvalent to this:
;;
;; { frame1: {"zoomed": false, "conf": <some conf>},
;; frame2: {"zoomed": true, "conf": <some other conf>} }
(defun save-window-conf ()
"Save current window configuration of current frame."
(let ((this-frame (selected-frame))
@MetroWind
MetroWind / Launch
Created December 25, 2017 20:26
KSP kOS launch script
CLEARSCREEN.
//This is our countdown loop, which cycles from 10 to 0
PRINT "Counting down:".
FROM {local countdown is 10.} UNTIL countdown = 0 STEP {SET countdown to countdown - 1.} DO
{
PRINT "..." + countdown.
WAIT 1. // pauses the script here for 1 second.
}
@MetroWind
MetroWind / style.css
Created June 17, 2019 22:58
DuckDuckGo multi-column
.results
{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-around;
}
.result
{
@MetroWind
MetroWind / plot.py
Created June 19, 2019 18:44
3D scatter plot
#!/usr/bin/env python
import sys, os
import numpy
import matplotlib
import matplotlib.font_manager as Fm
import matplotlib.backends.backend_pdf as PltPDF
from mpl_toolkits.mplot3d import Axes3D
def loadData(filename):
@MetroWind
MetroWind / perspective.html
Created August 8, 2019 22:30
CSS Perspective
<!doctype html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<style>
:root
{
--distance: 600px;
--angle: 30deg;