Skip to content

Instantly share code, notes, and snippets.

View kvpb's full-sized avatar
🍀

Karl kvpb

🍀
  • Paris, France
  • 09:27 (UTC +02:00)
View GitHub Profile
@nickrw
nickrw / volsay.sh
Created April 19, 2013 12:43
volsay: Wrapper around OSX's `say' command, which sets the system volume to the requested level, then restores volume / mute state once speech is complete.
#!/bin/bash
function usage() {
echo "usage: $0 <volume (0-100)> <say args...>"
echo
echo "Unmutes and sets the system volume to volume%, passing the remaining"
echo "arguments to the OSX \`say' command, restoring volume / mute setting"
echo "to previous values after the speech has completed."
exit 1
}
@wilkerlucio
wilkerlucio / reset_windows
Created December 16, 2009 19:26
Reset Mac OS windows positions
-- Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
property processesToIgnore : {}
-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
set _b to bounds of window of desktop
set screen_width to item 3 of _b
set screen_height to item 4 of _b
end tell
@rprichard
rprichard / showkey.cc
Created June 3, 2016 10:06
Single-file implementation of `showkey -a` for showing terminal input bytes
// Compile with g++ showkey.cc -o showkey
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
static inline char decodeUnixCtrlChar(char ch) {
@EdVanDance
EdVanDance / ruby-2.0.0-p451-readline-6.3.patch
Created March 24, 2014 11:52
fix rbenv install 2.0.0-p451 with readline 6.3
--- ext/readline/extconf.rb
+++ ext/readline/extconf.rb
@@ -19,6 +19,10 @@ def readline.have_func(func)
return super(func, headers)
end
+def readline.have_type(type)
+ return super(type, headers)
+end
+
@isaacl
isaacl / script.js
Created October 17, 2014 07:25
Userscript: Stop websites from hijacking keyboard shortcuts.
// ==UserScript==
// @name Disable website keyboard hooks
// @description Stop websites from hijacking keyboard shortcuts.
// @author Isaac Levy
// @run-at document-start
// @include *
// @grant none
// @version 0.0.1
// @namespace https://isaacrlevy.com
// ==/UserScript==
@rasschaert
rasschaert / arch_bootstrap.bash
Last active July 27, 2022 12:43
Shell script that performs the installation of Arch Linux the way I like it.
#!/bin/bash
bootstrapper_dialog() {
DIALOG_RESULT=$(dialog --clear --stdout --backtitle "Arch bootstrapper" --no-shadow "$@" 2>/dev/null)
}
#################
#### Welcome ####
#################
bootstrapper_dialog --title "Welcome" --msgbox "Welcome to Kenny's Arch Linux bootstrapper.\n" 6 60
@jacobsalmela
jacobsalmela / app-store-pkgs.sh
Created December 30, 2014 03:15
Save App Store downloads as .pkgs
#!/bin/bash
appStoreFolder=$(sudo find /private/var/folders -type f -name "*.pkg")
i=0
for package in $appStoreFolder
do
sudo ln $package ~/Downloads/_MAS_$i.pkg
i=$(($i+1))
done
@moismailzai
moismailzai / 0x5f3759df-quake-iii-arena-s-fast-inverse-square-root-function-explained.markdown
Last active October 25, 2022 07:38
0x5f3759df - Quake III Arena's Fast Inverse Square Root Function Explained
@hut8
hut8 / CSS CRT screen effect.markdown
Created November 9, 2015 06:47
CSS CRT screen effect
@scriptingosx
scriptingosx / userpictures.sh
Created October 23, 2018 07:24
sample script that loops through all users and sets a different user picture.
#!/bin/bash
# create an array from all images in the User Pictures subfolders
IFS=$'\n' read -rd '' -a pictures <<< "$(find '/Library/User Pictures/Fun' -name *.tif -print )"
# loop through all users
picIndex=0