Skip to content

Instantly share code, notes, and snippets.

View mainrs's full-sized avatar
⛩️
In zen

Sven mainrs

⛩️
In zen
View GitHub Profile
@sedm0784
sedm0784 / CapsLockCtrlEscape.ahk
Last active July 16, 2024 11:14
AutoHotkey script to map Caps Lock to Escape when it's pressed on its own and Ctrl when used in combination with another key, à la Steve Losh. Adapted from one that does something similar with the Ctrl Key on the Vim Tips Wiki (http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows?oldid=32281). (Plus contribs from @randy909 & @mmikeww.)
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*CapsLock::
if (g_ControlRepeatDetected)
{
return
}
@ryangreenberg
ryangreenberg / 1_README.md
Created April 21, 2013 17:56
Potentiometer video control

This is code used to control the playback speed of a video playing in Quicktime Player. Upload arduino_read_potentiometer.cpp on your Arduino and run processing_control_video.pde in Processing. See video demo at http://www.youtube.com/watch?v=UfDRINiV4Kg

@wandernauta
wandernauta / sp
Last active July 10, 2024 07:57
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@NobbZ
NobbZ / prime.lhs
Last active February 1, 2021 00:37
Primzahlen in Haskell
> module Main
> where
> import Data.List
Entnimmt einer Liste solange ein Element, bis das Quadrat des Elementes über-
geben an die Funktion f False ergibt.
> takeWhileSquare :: Num a => (a -> Bool) -> [a] -> [a]
> takeWhileSquare f (x:xs) | f (x^2) = x:takeWhileSquare f xs
> | otherwise = []
@levi
levi / riot_esports_api.md
Last active July 8, 2024 22:51
Riot LoL eSports Unofficial API Documentation
@quidmonkey
quidmonkey / index.html
Last active March 22, 2024 19:05
Three.js Mandelbrot Demo
<!DOCTYPE html>
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/three.js/r67/three.min.js"></script>
</head>
<body>
<script id="mandelbrot-vertex" type="x-shader/x-vertex">
precision highp float;
uniform float zoom;
varying vec2 pos;
@jcdickinson
jcdickinson / colorblind.glsl
Last active April 28, 2024 23:27
Colorblind Simulation Shader
/*-----------------------------------------------------------.
/ ColorBlind correction /
'-----------------------------------------------------------*/
// Daltonize (source http://www.daltonize.org/search/label/Daltonize)
// Modified to simulate color blindness.
float4 Daltonize( float4 input, float2 tex )
{
// RGB to LMS matrix conversion
float3 L = (17.8824f * input.r) + (43.5161f * input.g) + (4.11935f * input.b);
float3 M = (3.45565f * input.r) + (27.1554f * input.g) + (3.86714f * input.b);
@mikroskeem
mikroskeem / 0x0.sh
Last active April 19, 2024 10:46
Arch Linux must-have packages
#!/usr/bin/env bash
0x0() {
case "${1}" in
"s")
shift
local url=`curl --silent -F"shorten=${1}" https://0x0.st | sed 's/\n//'`
echo -n "${url}"
;;
"u")
@tjade273
tjade273 / Database.sol
Last active April 6, 2024 04:32
Example of separated storage and logic
contract Database{
mapping(uint => uint) public _data;
mapping(address => bool) _owners;
function Database(address[] owners){ //Called once at creation, pass in initial owners
for(uint i; i<owners.length; i++){
_owners[owners[i]]=true;
}
}
@logrusorgru
logrusorgru / mysql.sql
Last active January 16, 2024 07:01
SQL: uniqueness, automatic created_at, updated_at refresh + soft delete. SQLite, PostgreSQL, MySQL
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
-- mysql --
-- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
-- mysql <http://sqlfiddle.com/#!9/91afb5/2>
-- note: sqlfiddle is very stupid