Skip to content

Instantly share code, notes, and snippets.

@ageis
ageis / systemd_service_hardening.md
Last active May 4, 2024 15:57
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@agnoster
agnoster / README.md
Last active April 6, 2024 22:35
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@astrofrog
astrofrog / async_plotting.py
Created December 10, 2011 00:11
Asynchronous Plotting in Matplotlib: rather than call savefig directly, add plots to an asynchronous queue to avoid holding up the main program. Makes use of multiple processes to speed up the writing out. Suggestions welcome!
import time
import multiprocessing as mp
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
@neomatrix369
neomatrix369 / PerformanceRelated.md
Last active November 3, 2023 20:27
Interesting links in the areas of HPC, low latency, mechanical harmony/sympathy, garbage collection
@fmela
fmela / stacktrace.cxx
Last active September 22, 2023 10:58
A C++ function that produces a stack backtrace with demangled function & method names.
/*
* Copyright (c) 2009-2017, Farooq Mela
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@rednaxelafx
rednaxelafx / JDK5u22_client.log
Created August 23, 2011 16:43
PrintCompilation samples running Groovy shell 1.7.7 on different versions of HotSpot VM
1 b java.lang.String::charAt (33 bytes)
2 b java.lang.Math::max (11 bytes)
3 b java.util.jar.Manifest$FastInputStream::readLine (167 bytes)
4 b sun.nio.cs.UTF_8$Decoder::decodeArrayLoop (553 bytes)
5 b java.util.Properties$LineReader::readLine (383 bytes)
6 b java.lang.String::hashCode (60 bytes)
7 b java.lang.String::indexOf (151 bytes)
8 b sun.nio.cs.ext.DoubleByteDecoder::decodeSingle (10 bytes)
9 b java.lang.String::lastIndexOf (156 bytes)
10 b java.lang.String::replace (142 bytes)
@preshing
preshing / sort1mb.cpp
Created October 25, 2012 11:28
Sort one million 8-digit numbers in 1MB RAM
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned long long u64;
//-------------------------------------------------------------------------
// WorkArea
//-------------------------------------------------------------------------
@jcartledge
jcartledge / ~_.config_terminator_config
Created April 27, 2011 04:31
terminator config solarized
[global_config]
title_transmit_bg_color = "#839496"
title_inactive_fg_color = "#93a1a1"
title_transmit_fg_color = "#eee8d5"
title_inactive_bg_color = "#586e75"
[keybindings]
[profiles]
[[default]]
palette = "#073642:#d30102:#859900:#b58900:#6c71c4:#d33682:#2aa198:#839496:#586e75:#cb4b16:#859900:#b58900:#268bd2:#d33682:#2aa198:#93a1a1"
login_shell = True