Skip to content

Instantly share code, notes, and snippets.

View adaedra's full-sized avatar

Thibault “Adædra” Hamel adaedra

View GitHub Profile

$x^2 = \frac{-x^3}{\sqrt{x}}$

#!/bin/sh
if [ "${1}" = '-f' ]; then
cmd='git branch -D'
else
cmd='echo Will delete'
fi
LANG=en_US.UTF-8 \
git branch --list --format '%(upstream:track,nobracket):%(refname:lstrip=2)' | \
@adaedra
adaedra / init.vim
Created March 23, 2018 17:09
Vim basic config
" Plugins
call plug#begin('~/.local/share/nvim/plugged')
Plug 'arcticicestudio/nord-vim'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
call plug#end()
" Basic settings
set number
@adaedra
adaedra / playground.rs
Created September 20, 2016 20:58 — forked from anonymous/playground.rs
Shared via Rust Playground
struct Manager {
callbacks: Vec<Box<FnMut()>>,
}
impl Manager {
fn new() -> Manager {
Manager { callbacks: Vec::new() }
}
fn register(&mut self, callback: Box<FnMut()>) {
adaedra › ll sample
-rw-r--r-- 1 adaedra wheel 1.0G May 18 20:22 sample
adaedra › time shasum -a 512 sample
91db271ec41220b0a608b32e59785b062bb06ca6df87c0750d44c10b17914f23ca87b5a486827a3a5dd34d56786c991ef58ac5c9f7d74b084b1fecec92034cf2 sample
shasum -a 512 sample 3.79s user 0.21s system 99% cpu 3.999 total
adaedra › time ruby -rdigest -e "puts Digest::SHA512.file('sample').hexdigest"
91db271ec41220b0a608b32e59785b062bb06ca6df87c0750d44c10b17914f23ca87b5a486827a3a5dd34d56786c991ef58ac5c9f7d74b084b1fecec92034cf2
ruby -rdigest -e "puts Digest::SHA512.file('sample').hexdigest" 1.76s user 0.25s system 99% cpu 2.015 total
adaedra › touch toto
adaedra › pry
[1] pry(main)> Dir.mkdir 'toto' rescue $!
=> #<Errno::EEXIST: File exists @ dir_s_mkdir - toto>
@adaedra
adaedra / config.ru
Created March 11, 2016 21:04
Rack full example
Application = proc do |env|
names = env['names'] || %w[world]
text = "Hello, #{names.join ', '}!"
[200, {'Content-Type' => 'text/plain'}, [text]]
end
class NameMiddleware
def initialize(app)
@app = app
end
@adaedra
adaedra / cookiebot.js
Created October 2, 2013 23:35
CookieBot
// Crafted cookies taste awful
var CookieBot = Array();
CookieBot.Function = function () {
var o = CookieBot.BuyNext();
Game.ClickCookie();
if (Game.Objects[o].price <= Game.cookies) {
Game.Objects[o].buy();
}
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#define PASSWORD_LENGTH 10
int main(void) {