Skip to content

Instantly share code, notes, and snippets.

tobia

Block or report user

Report or block tobia

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
@tobia
tobia / gnome-terminal-bold-fonts.sh
Created Jun 9, 2019 — forked from arturfog/gnome-terminal-bold-fonts.sh
disable bold fonts in gnome terminal
View gnome-terminal-bold-fonts.sh
dconf write /org/gnome/terminal/legacy/profiles:/:<id>/allow-bold false
@tobia
tobia / test_count.rs
Created Apr 12, 2019
Simple harness to measure macro expansion time
View test_count.rs
// #![recursion_limit="1003"]
// macro_rules! count {
// () => (0usize);
// ($x:tt $($xs:tt)*) => (1usize + count!($($xs)*));
// }
macro_rules! count {
() => (0usize);
($one:tt) => (1usize);
($($pairs:tt $_p:tt)*) => (count!($($pairs)*) << 1usize);
View sample_time_data.json
[{"week":"2007-12-31", "val":18848},
{"week":"2008-01-07", "val":18567},
{"week":"2008-01-14", "val":7916},
{"week":"2008-01-21", "val":7337},
{"week":"2008-01-28", "val":-1296},
{"week":"2008-02-04", "val":7038},
{"week":"2008-02-11", "val":3522},
{"week":"2008-02-18", "val":4957},
{"week":"2008-02-25", "val":-6891},
{"week":"2008-03-03", "val":10226},
@tobia
tobia / luminv.c
Created Sep 7, 2017
Fast luminance inversion (aka. color invert + hue rotate 180°)
View luminv.c
// Fast luminance inversion.
int luminv(int rgb) {
int r = rgb >> 16,
g = rgb >> 8 & 0xff,
b = rgb & 0xff;
switch (((r > g) << 1 | (g > b)) << 1 | (b > r)) {
case 4: // r > b > g
case 3: // g > b > r
return rgb + (255 - r - g) * 0x10101;
case 2: // g > r > b
@tobia
tobia / feynman.ml
Created Aug 11, 2017
PBS SpaceTime Feynman Diagram Challenge
View feynman.ml
(*
Compute all possible Feynman diagrams with 1 el + 1 pos input,
1 el + 1 pos output, 4 nodes, and no self-energetic transitions.
*)
open Core.Std
type particle = Electron | Positron | Photon [@@deriving compare, sexp]
let inverse = function
| Photon -> Photon
@tobia
tobia / 8kzenrecover.py
Last active Nov 16, 2018 — forked from lkraav/8kzenrecover.py
8kzenrecover.py (Zen Vision M data recovery script) updated to work without LRU.py
View 8kzenrecover.py
#!/usr/bin/python
# Copyright 2007 by Tobia Conforto <tobia.conforto@gmail.com>
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
@tobia
tobia / doge.md
Created Aug 4, 2016 — forked from cpdean/doge.md
YOU'RE WELCOME, INTERNET. -- if you search for an ascii doge, you don't get anything great that you can copy paste. found a silly gif (http://cmang.org/ascii/cm-doge-bw.gif) and i have transcribed it for all of you
View doge.md

no clue who made this, but i have transcribed it here:

                Y.                      _   
                YiL                   .```.  
                Yii;                .; .;;`.    
                YY;ii._           .;`.;;;; :    
                iiYYYYYYiiiii;;;;i` ;;::;;;;    
            _.;YYYYYYiiiiiiYYYii  .;;.   ;;; 
         .YYYYYYYYYYiiYYYYYYYYYYYYii;`  ;;;;    
@tobia
tobia / .ghci
Created May 31, 2016
Haskell configuration
View .ghci
:set prompt "\ESC[31;1m\STXλ>\ESC[m\STX "
:set -XOverloadedStrings
:set -XNegativeLiterals
:def pf \str -> return $ ":! pointfree '" ++ str ++ "'"
@tobia
tobia / TryCatchTagLib.groovy
Created Jul 2, 2015
Simple try & catch taglib for Grails GSP views.
View TryCatchTagLib.groovy
// Simple try & catch for GSP views.
//
// Usage:
//
// <g:try>
// view snippet that needs to be checked
// </g:try>
// <g:catch>
// alternative view code in case of errors;
// the exception is available as ${exception}
You can’t perform that action at this time.