Skip to content

Instantly share code, notes, and snippets.

View pedroarthur's full-sized avatar

Pedro Arthur Duarte [aka JEdi] pedroarthur

View GitHub Profile
/* imports suppressed */
class MemoizingActor(actual: ActorRef) extends Actor {
case class DropState(message: Any)
override def receive: Actor.Receive = actualReceive(Map())
def actualReceive(data: Map[Any, Future[Any]]): Receive = {
case DropState(any) =>
@pedroarthur
pedroarthur / mutex_master.c
Created July 28, 2016 18:51
DEBUG_LOCKS_WARN_ON(lock->owner != current)
#include <linux/module.h>
#include <linux/init.h>
#include <linux/mutex.h>
DEFINE_MUTEX (master_mutex);
EXPORT_SYMBOL(master_mutex);
static int __init mutex_master_init(void)
@pedroarthur
pedroarthur / layer-display-toggle.py
Created October 5, 2016 01:22
Parse a SVG file and creates few others that display a layer at a time (eg, to use with LaTeX xmpmulti's multiinclude)
from xml.dom.minidom import parse as parse_xml_from_file
from sys import argv, exit
# SVG file name (drawing.svg)
input_file = argv[1]
# Output files prefix (animation/steps)
output_prefix = argv[2]
# one or more layers suffixes
[kwin][Global Shortcuts]
Activate Window Demanding Attention=Meta+A
ExposeAll=Meta+F
ExposeClass=Meta+Shift+F
Kill Window=Meta+Ctrl+Alt+Esc
MoveMouseToCenter=Meta+F6
MoveMouseToFocus=Meta+F5
ShowDesktopGrid=Meta+F8
Suspend Compositing=Meta+Alt+Shift+F12
Switch One Desktop Down=Meta+Ctrl+J
function run_and_focus (event) {
var note = IPython.notebook;
var current_cell = note.get_selected_cell();
note.execute_cell_range(note.get_selected_index(), note.ncells());
current_cell.focus_cell();
return false;
}
@pedroarthur
pedroarthur / userChrome.css
Created July 8, 2018 04:16
Change Firefox UI to i) auto hide address bar; and ii) hide tab bar when there is only one tab opened
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/*
* From https://gist.github.com/BenoitAverty/af633ee20e27f48f9ba7178451432206
*/
#tabbrowser-tabs, #tabbrowser-tabs > .tabbrowser-arrowscrollbox {
min-height: 0 !important;
}
@pedroarthur
pedroarthur / iat.ipynb
Last active August 21, 2018 21:34
Inter Arrival Time of Network Packets
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pedroarthur
pedroarthur / install_packages.sh
Created June 30, 2019 18:45
Minimal KDE Plasma on Debian Buster
#!/bin/bash
set -x;
apt-get update -yq
packages=(
# can I haz sandwich?
aspell-en
hunspell-en-us
@pedroarthur
pedroarthur / sed-delatex.sh
Created September 9, 2019 16:35
The simplest LaTeX syntax remover
sed \
-r \
-e 's/^%.*$//' \
-e 's/\\emph\{([^{]+)\}/\1/g' \
-e 's/\\ref\{([^{]+)\}/\1/g' \
-e 's/\\cite\{([^{]+)\} //g' \
-e 's/ \\cite\{([^{]+)\}//g' \
-e 's/\$.+\$/formula/' \
-e 's/~/ /' \
-e '/\\begin\{figure\}/,/\\end\{figure\}/d' \
@pedroarthur
pedroarthur / xid.sh
Created October 9, 2019 15:53
Bash script to run a X application in Docker
#!/bin/bash
USER_ID=$(id -u "$(whoami)")
GROUP_ID=$(id -g "$(whoami)")
XSOCK=/tmp/.X11-unix
XAUTH=$(mktemp /tmp/docker.xauth.XXXX)
trap 'rm $XAUTH; ' EXIT