Skip to content

Instantly share code, notes, and snippets.

@jboner
jboner / latency.txt
Last active May 9, 2024 06:01
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
@josheinstein
josheinstein / DataSize.cs
Created May 18, 2012 16:15
DataSize Class (C#)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
@mycodeschool
mycodeschool / BalancedParentheses.cpp
Created October 29, 2013 00:49
C++ Program to check for balanced parentheses in an expression using stack.
/*
C++ Program to check for balanced parentheses in an expression using stack.
Given an expression as string comprising of opening and closing characters
of parentheses - (), curly braces - {} and square brackets - [], we need to
check whether symbols are balanced or not.
*/
#include<iostream>
#include<stack>
#include<string>
using namespace std;
@tindy2013
tindy2013 / _subconverter_configs.md
Last active May 9, 2024 05:57
subconverter_configs

This is a gist repository for some external configs for subconverter, you can use the raw address of the following INIs to generate a specified set of rules, groups and/or scripts.

@johndturn
johndturn / launchd-for-services.md
Last active May 9, 2024 05:55
Overview of using launchd to set up services on a macOS machine.

launchd - Script Management in macOS

What is it?

  • Used on macOS for managing agents and daemons and can be used to run scripts at specified intervals
    • macOS's competitor to cron, along with other things
  • Runs Daemons and Agents

What is a Daemon?

@MjHead
MjHead / form-custom-hook.php
Created September 19, 2021 08:07
JetFormBuilder. Example of custom hook with API request and redirect.
<?php
/**
* 'api-request' - is a customm hook name
*/
add_action( 'jet-form-builder/custom-action/api-request', function( $request, $action_handler ) {
$post_id = ! empty( $request['inserted_post_id'] ) ? $request['inserted_post_id'] : false;
if ( ! $post_id ) {
return;
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 9, 2024 05:53
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@Crocoblock
Crocoblock / jfb-call-hook.php
Last active May 9, 2024 05:52
JetFormBuilder Call Hook action
<?php
add_action( 'jet-form-builder/custom-action/test-hook', function( $request, $action_handler ) {
//get value of field field1
$value = $request['field1'];
//or using jet_fb_context()->resolve_request()
$value = jet_fb_context()->resolve_request()['field1'];
@willurd
willurd / web-servers.md
Last active May 9, 2024 05:48
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000