Skip to content

Instantly share code, notes, and snippets.

@Miista
Miista / latency_numbers.md
Created May 22, 2017 18:04 — forked from GLMeece/latency_numbers.md
Latency Numbers Every Programmer Should Know - MarkDown Fork

Latency Comparison Numbers

Note: "Forked" from Latency Numbers Every Programmer Should Know

Event Nanoseconds Microseconds Milliseconds Comparison
L1 cache reference 0.5 - - -
Branch mispredict 5.0 - - -
L2 cache reference 7.0 - - 14x L1 cache
Mutex lock/unlock 25.0 - - -
ls *.<file-ext> | entr pandoc *.<file-ext> -o <output-name>
@Miista
Miista / Git Interactive Rebase Tips
Created May 9, 2014 18:59
Tips for using "git rebase --interactive"
If the commit you want to fix isn’t the most recent one:
git rebase --interactive $parent_of_flawed_commit
If you want to fix several flawed commits, pass the parent of the oldest one of them.
An editor will come up, with a list of all commits since the one you gave.
Change pick to reword (or on old versions of Git, to edit) in front of any commits you want to fix.
Once you save, Git will replay the listed commits.
@Miista
Miista / Checkout PR
Created April 3, 2014 17:32
Checkout PR
git fetch origin pull/2/head
git checkout -b pullrequest FETCH_HEAD
OR
git fetch origin pull/<#>/head:<local_branch_name>
@Miista
Miista / Remove Homebrew package
Last active September 19, 2018 20:05
Remove a Homebrew package along with all of its dependencies
brew rm FORMULA
brew rm $(join <(brew leaves) <(brew deps FORMULA))
Run the last line a until `echo $(join <(brew leaves) <(brew deps FORMULA))` returns nothing OR until the last line informs you that `This command requires a keg argument`.
var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
// Include latest version
javascript:if(!window.jQuery||confirm('Overwrite\x20current\x20version?\x20v'+jQuery.fn.jquery))(function(d,s){s=d.createElement('script');s.src='http://code.jquery.com/jquery.js';(d.head||d.documentElement).appendChild(s)})(document);
// Include specific version
CREATE TABLE cast_info AS
SELECT DISTINCT ci.movie_id, ci.person_id, cn.name AS char_name, rt.role, ci.note, ci.nr_order
FROM imdb.ex x, imdb.cast_info ci, imdb.role_type rt, imdb.char_name cn
WHERE x.id = ci.movie_id
AND ci.role_id = rt.id
AND ci.person_role = cn.id;
@Miista
Miista / Specific version of Homebrew package
Last active August 29, 2015 13:57 — forked from gcatlin/gist:1847248
Install a specific version of a Homebrew package
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
@Miista
Miista / VisualStateHelper
Created February 20, 2014 08:03
VisualStateHelper for .NET
using System;
using System.Collections;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
namespace NCore.Helpers {
public class VisualStateHelper {
public static void HookEvent<T>( DependencyObject onElement, string inVisualStateGroup, EventHandler<VisualStateChangedEventArgs> setHandler) where T : DependencyObject {
T button = VisualStateHelper.FindSimpleVisualChild<T>(onElement);