Skip to content

Instantly share code, notes, and snippets.

View encode.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[])
int i;
unsigned char buffer[4096];
View rdtsc.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#define rdtsc() ({ uint64_t x; asm volatile("rdtsc" : "=A" (x)); x; })
#define TRIALS 20
char chars[] = "!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
fn exchange_first_last(a: &str) -> String {
// Convert to a vector so we can change it
let mut out: Vec<char> = a.chars().collect();
// Swap the first and last character
let len = out.len();
out.swap(0, len - 1);
// Convert into a String
# fish theme: gentoo
function _git_branch_name
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
function _is_git_dirty
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
View houdin.txt
"This mode of regulating the clock enables me to employ, when
necessary, a little artifice which I find very useful, and
which I will confide to you, reader, on condition however that
you keep it a profound secret, for if once known my expedient
would lose all its effect. When for any reason I desire to
advance or retard the hour of a meal, but secretly pressing a
certain electric button place in my study, I can put forward
or back at pleasure all the clocks, as well as the striking
apparatus. The cook often fancies that the time has passed
somehow very quickly, and I myself have gained a quarter of
View init.vim
scriptencoding utf-8
" To install nvim on ubuntu:
" sudo apt-get install software-properties-common
" sudo add-apt-repository ppa:neovim-ppa/unstable
" sudo apt-get update
" sudo apt-get install neovim
" sudo apt-get install python-dev python-pip python3-dev python3-pip
" sudo update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 60
" sudo update-alternatives --config vi
View index.js
import React from 'react';
import ReactDOM from 'react-dom';
import _ from 'lodash';
import './index.css';
function Square(props) {
return (
<button className="square" onClick={props.onClick}>
View tmux.conf
# Don't delay after <esc>
set -g escape-time 10
# Handle 24-bit colours correctly, maybe
#set -g default-terminal "xterm"
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm:Tc"
## This is from:
pub fn from_binary(s: &str) -> Option<u32> {
let total: u32 = s.chars().rev().enumerate().map(|c| {
let (i, c) = c;
if c == '1' {
(2 as u32).pow(i as u32)
} else {