Skip to content

Instantly share code, notes, and snippets.

View Andrewpk's full-sized avatar
🐶
wat

Andrew Kehrig Andrewpk

🐶
wat
  • wat
  • Royal Oak, Michigan
View GitHub Profile
@jboner
jboner / latency.txt
Last active May 2, 2024 09:45
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@stkent
stkent / android_studio_shortcuts.md
Last active November 1, 2023 11:58
Android Studio Shortcuts (Mac)

Android Studio Shortcuts (Mac)

Notes:

  • Two of the most useful shortcuts utilize the Fn (function) keys. It is therefore recommended that you enable the "Use all F1, F2, etc. keys as standard function keys" option [System Preferences > Keyboard].
  • Be sure to enable the Mac OS X 10.5+ keymap in Android Studio [Preferences > Keymap].
  • A fairly complete shortcut list can be found here.

Useful symbols:

@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@SlaunchaMan
SlaunchaMan / SwiftUIStackView.swift
Created June 16, 2020 14:03
A SwiftUI-like function builder approach for UIStackView.
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
@_functionBuilder
struct UIViewBuilder {
static func buildBlock(_ views: UIView...) -> [UIView] {
return views
}
@jmreidy
jmreidy / test_mocha.opts
Last active January 9, 2018 11:49
Unit test React Native with Mocha
--compilers js:./test/support/compiler
--require ./test/support/init
#!/usr/bin/env ruby
#
# This script can be used to check the in-store availability of the iPhone 5S.
# By default, it searches for all AT&T models. You can change this by editing
# the MY_DEVICES array below. While the Apple API supports searching for
# multiple devices at once, there is a limit.
#
# Once you have properly configured the MY_DEVICES array, you can run this script
# from the terminal. It takes a single parameter, which should be the zip code you
# wish to use for your search.
@melo
melo / eheh.pl
Created August 8, 2013 07:49
Make up your mind, please...
if ($config->{sms_notifications_enabled}) {
$log->warn("SMS notifications are disabled, use ENV ENABLE_SMS_NOTIFICATIONS to enable")
unless $config->{i_know_sms_notifications_are_disabled_please_leave_me_alone};
return;
}
@melo
melo / merge.pl
Created January 9, 2013 17:22
Merge the content of two single page PDFs, on a pretty template, the other an invoice, into a new *single* page PDF, using Perl PDF::API2
#!/usr/bin/env perl
use strict;
use warnings;
use PDF::API2;
my ($template_pdf, $data_pdf) = @ARGV;
my $t_pdf = PDF::API2->open($template_pdf);
my $page = $t_pdf->openpage(1);
@igorw
igorw / y.php
Created December 30, 2012 16:49
<?php
$factorial = call_user_func(
function ($le) {
return call_user_func(
function ($f) {
return $f($f);
},
function ($f) use ($le) {
return $le(function ($x) use ($f) {