View encode.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
int main(int argc, char *argv[]) | |
{ | |
int i; | |
srand(0x13371337); | |
unsigned char buffer[4096]; |
View rdtsc.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"; |
View main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
out.into_iter().collect() |
View fish_prompt.fish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fish theme: gentoo | |
function _git_branch_name | |
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') | |
end | |
function _is_git_dirty | |
echo (command git status -s --ignore-submodules=dirty ^/dev/null) | |
end |
View test.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test |
View houdin.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |
View old_from_binary.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | |
0 | |
} | |
}).sum(); |
NewerOlder