Skip to content

Instantly share code, notes, and snippets.

@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

@YDrall
YDrall / kmp.cpp
Created August 18, 2015 16:10
c++ implementation of kmp string matching algorithm.
#include<iostream>
#include<string>
using namespace std;
int *pre_kmp(string pattern)
{
int size = pattern.size();
int *pie=new int [size];
pie[0] = 0;
@mks-d
mks-d / bahrain_ah.csv
Last active May 7, 2024 06:12
Bahrain address hierarchy: 'Governorate', 'Place', 'Block'
Southern Aáli 746
Southern Aáli 748
Southern Al Door 965
Southern Algainah 961
Southern Al Hajyat 929
Southern Al Hajyat 931
Southern Al Hajyat 935
Southern Al Hajyat 939
Southern Al Hunaniya 901
Southern Al Hunaniya 903
@er-pkumar
er-pkumar / laravel-pint.md
Last active May 7, 2024 06:11
Laravel Pint is a tool built on top of PHP-CS-Fixer for PHP code that helps you style your code in a specific way, especially if you prefer a minimalist approach.

What?

Laravel Pint is a tool built on top of PHP-CS-Fixer for PHP code that helps you style your code in a specific way, especially if you prefer a minimalist approach. By default install by installing fresh laravel application, Pint does not require any configuration and will fix code style issues in your code by following the opinionated coding style of Laravel.

Why Pint?

  • Consistency: Pint enforces a consistent code style across your Laravel projects, making it easier for developers to read and understand each other's code.
@er-pkumar
er-pkumar / search_multiple_column.md
Last active May 7, 2024 06:11
Laravel way to search across multiple column in table
$searchString = $request->validated('keyword');
$user = User::whereAny(
    [
        'first_name',
        'last_name',
        'email'
    ],
 'ilike',
@agritheory
agritheory / unshallow_clone_repo.md
Last active May 7, 2024 06:11
Create a full clone of a Frappe app locally

Create a full clone of a Frappe app locally

Synthesized from several helpful stackoverflow responses and some trial and error. This is intended for use in a development or possibly staging environment.

bench get-app cloud_storage git@github.com:agritheory/cloud_storage.git --skip-assets

This will complete the default clone/install (but not build) of a Frappe app.

@drautb
drautb / CMake: Variable Dump
Created July 3, 2013 20:11
This snippet will dump all CMake variables to the build output
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
@natedileas
natedileas / redirect.py
Last active May 7, 2024 06:10
c-level stdout redirection on windows
""" Tested on Windows 10, 64 bit, Python 3.6
Sources:
https://eli.thegreenplace.net/2015/redirecting-all-kinds-of-stdout-in-python/
https://stackoverflow.com/questions/17942874/stdout-redirection-with-ctypes
"""
from contextlib import contextmanager
import ctypes
import io
import os, sys
@kyo-takano
kyo-takano / making-the-most-of-local-llms.ipynb
Last active May 7, 2024 06:08
ローカルLLMはこーやって使うの💢
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PurpleVibe32
PurpleVibe32 / vmwk17key.txt
Last active May 7, 2024 06:08
Free VMware Workstation Pro 17 full license keys
Install VMWare Workstation PRO 17 (Read it right. PRO!)
Also, these keys might also work with VMWare Fusion 13 PRO. Just tested it.
Sub to me on youtube pls - PurpleVibe32
if you want more keys - call my bot on telegram. @purector_bot (THE BOT WONT REPLY ANYMORE) - Or: https://cdn.discordapp.com/attachments/1040615179894935645/1074016373228978277/keys.zip - the password in the zip is 102me.
---
This gist can get off at any time.
PLEASE, DONT COPY THIS. IF YOU FORK IT, DONT EDIT IT.
*If you have a problem comment and people will try to help you!
*No virus