Skip to content

Instantly share code, notes, and snippets.

Raphael akerbos

Block or report user

Report or block akerbos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@akerbos
akerbos / shortcuts.py
Last active Apr 26, 2018
Ubuntu keyboard shortcuts you want to disable for JetBrains IDEs
View shortcuts.py
# cf. http://askubuntu.com/a/863486/69674
# Places to look for shortcuts in dconf-editor:
# - org.compiz.integrated
# - org.freedesktop.ibus.general.hotkey (?)
# - org.gnome.settings-daemon.plugins.media-keys
# - org.gnome.desktop.wm.keybindings
# - org.gnome.metacity.keybindings
shortcuts = {
# CTRL + ALT + Backspace
@akerbos
akerbos / dpquicksort.py
Created Jul 4, 2016
Dual-Pivot Quicksort
View dpquicksort.py
def swap(lst, i, j):
if min(i,j) >= 0 and max(i,j) < len(lst) and i != j:
lst[i], lst[j] = lst[j], lst[i]
lst.log()
# This is Dual-Pivot Quicksort by Yaroslavskiy et al.
# Implemented following Sebastian Wild as in
# https://www.uni-trier.de/fileadmin/fb4/prof/INF/TIN/Theorietag/TR.pdf
# page 39
# Plus a bugfix: need to swap pivot candidates, otherwise swapping-in pivots in the end
@akerbos
akerbos / dpquicksort.py
Created Jul 4, 2016
Dual-Pivot Quicksort
View dpquicksort.py
def swap(lst, i, j):
if min(i,j) >= 0 and max(i,j) < len(lst) and i != j:
lst[i], lst[j] = lst[j], lst[i]
lst.log()
# This is Dual-Pivot Quicksort by Yaroslavskiy et al.
# Implemented following Sebastian Wild as in
# https://www.uni-trier.de/fileadmin/fb4/prof/INF/TIN/Theorietag/TR.pdf
# page 39
def dpquicksort(lst, left=0, right=None):
@akerbos
akerbos / remove-hot-qs-SE.css
Last active Jan 17, 2016
Remove Hot Network Questions on SE
View remove-hot-qs-SE.css
@namespace url(http://www.w3.org/1999/xhtml);
/* From https://gist.github.com/akerbos/152d7891d2b8b34edf3a */
@-moz-document domain('stackoverflow.com'),
domain('stackexchange.com'),
domain('superuser.com'),
domain('serverfault.com'),
domain('stackapps.com'),
domain('askubuntu.com'),
@akerbos
akerbos / optimal_five_sort.rb
Created Aug 3, 2015
Comparison-optimal sorting algorithm for five elements, plus testing code. (via Knuth TAoCP Vol 3, 2nd ed, 5.3.1)
View optimal_five_sort.rb
def swap(a, i, j)
t = a[i]
a[i] = a[j]
a[j] = t
end
def sort(a)
# Sort first two pairs
swap(a,0,1) if a[1] < a[0]
swap(a,2,3) if a[3] < a[2]
@akerbos
akerbos / parallel-listen.rb
Created May 6, 2015
MWE for conflict of listen and parallel gems
View parallel-listen.rb
#!/usr/bin/ruby
require 'rubygems'
gem "parallel"
require 'parallel'
gem "listen"
require 'listen'
listener = Listen.to('.') do |modified, added, removed|
$changetime = Time.now
@akerbos
akerbos / Fix SE top bar to window top
Last active Sep 18, 2017
Changes the new Stack Exchange top bar so that it stays fixed even when scrolling.
View Fix SE top bar to window top
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain('stackoverflow.com'),
domain('stackexchange.com'),
domain('superuser.com'),
domain('serverfault.com'),
domain('stackapps.com'),
domain('askubuntu.com'),
domain('mathoverflow.com'),
domain('answers.onstartups.com'),
You can’t perform that action at this time.