Skip to content

Instantly share code, notes, and snippets.

View pacuna's full-sized avatar

Pablo Acuña pacuna

  • Spotify
  • Austin, TX
View GitHub Profile
@marshyon
marshyon / main.go
Last active September 20, 2023 05:59
Golang badger db using GOB to serialise object data into badger fields
/*
*
* Golang badger db using GOB to serialize object data into badger fields
*
* Golang has its very own serializer / deserializer - Go Object (gob) so why not use it where data passed is entirely within a Go
* application ?
*
* JSON or some other text based solution could be used but gob might be faster.
*
* A gob encoder accepts the type bytes.Buffer to encode data to, so to write this to Badger, which accepts the type byte
@ErikAugust
ErikAugust / spectre.c
Last active April 15, 2024 13:55
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif

Quick Tips for Fast Code on the JVM

I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.

This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea

@molotovbliss
molotovbliss / terminalrc
Created December 14, 2017 08:41
Dracula Theme for XFCE4 Terminal
ColorBackground=#28282a2a3636
ColorForeground=#f8f8f8f8f2f2
ColorSelection=#363639394848
ColorBold=#f4f47676c3c3
ColorCursor=#5050fafa7b7b
TabActivityColor=#5050fafa7b7b
ColorPalette=#000000000000;#9a9a40404646;#90907979b3b3;#929298986363;#3d3d98985a5a;#9a9a53538282;#3a3a4d4d5b5b;#8bfc8bfc8ccc;#4d4d4d4d4d4d;#ffff55555555;#cacaa9a9fafa;#f1f1fafa8c8c;#5050fafa7b7b;#ffff7979c6c6;#8b8be9e9fdfd;#f8f8f8f8f2f2
ColorSelectionUseDefault=FALSE
ColorBoldUseDefault=FALSE
@davidpelayo
davidpelayo / mbox-to-csv.py
Created March 3, 2016 21:28
Simple mbox parser to csv in Python
import mailbox
import csv
writer = csv.writer(open("mbox-output.csv", "wb"))
for message in mailbox.mbox('file.mbox/mbox'):
writer.writerow([message['message-id'], message['subject'], message['from']])
@haasn
haasn / about:config.md
Last active April 2, 2024 18:46
Firefox bullshit removal via about:config

Firefox bullshit removal

Updated: Just use qutebrowser (and disable javascript). The web is done for.

@kainam00
kainam00 / rvm-amazon-linux.bash
Created July 31, 2015 15:31
Install RVM on Amazon Linux
#!/bin/bash
# Install prerequisites
yum install -y gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel ruby-devel gcc-c++ jq git
# Import key
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
# Install RVM
curl -sSL https://get.rvm.io | bash -s stable --ruby
@brianz
brianz / install-docker.sh
Last active July 7, 2023 07:32
Install docker on Amazon Linux
#!/bin/bash
#
# steps taken verbatim from:
# http://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html#install_docker
#
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# log out and log in to pickup the added group
@whistler
whistler / import.sh
Created March 16, 2015 17:31
Copy files to another repository while saving git history
# copied from http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/
git clone <git repository A url> # clone source repository
cd <git repository A directory>
git remote rm origin # to make sure it doesn't affect the original repository
git filter-branch --subdirectory-filter <directory 1> -- --all # remove all files other than the ones needed
mkdir <directory 1> # move them into another directory where they will be stored in the destination repository (if needed)
mv * <directory 1>
git add .
git commit
@nf
nf / vm-setup.sh
Last active June 14, 2023 22:08
Script for setting up Debian Jessie VM with my development environment
#!/bin/bash -e
echo '
PATH=$HOME/go/bin:$PATH
export GOPATH=$HOME
export CDPATH=.:$HOME/src/golang.org/x:$HOME/go/src:$HOME/src/github.com:$HOME/src/github.com/nf:$HOME/src/github.com/adg
export EDITOR=vim
' >> ~/.profile
sudo apt-get update