Skip to content

Instantly share code, notes, and snippets.

@jboner
jboner / latency.txt
Last active May 3, 2024 15:17
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
@mrkmg
mrkmg / genColorCodeFromText.php
Created January 13, 2012 17:22
Generate a unique color based on text input
<?php
/*
* Outputs a color (#000000) based Text input
*
* @param $text String of text
* @param $min_brightness Integer between 0 and 100
* @param $spec Integer between 2-10, determines how unique each color will be
*/
function genColorCodeFromText($text,$min_brightness=100,$spec=10)
@macshome
macshome / EnvironmentVariables.swift
Created May 2, 2024 12:48
A playground to see different ways to get environment variables in Swift
import Foundation
// A playground to see different ways to get environment variables in Swift
// Foundation is the easiest way using the awesome ProcessInfo class.
// Get all of the environment variables for your running process in a Dictionary.
let foundationEnv = ProcessInfo().environment
print("********** ProcessInfo Environment **********")
@blessanm86
blessanm86 / german-driving-license.md
Last active May 3, 2024 15:15
Quick Ref Notes for German Driving License Test

This is unmaintained and was created for personal use. As I passed the exam I have no use to keep this up to date. Feel free to fork

What are the consequences for a person driving a motor vehicle under the influence of drugs (e.g. hashish, heroin, cocaine)?

[x] Confiscation of driving licence or driving ban
[x] Compulsory medical/psychological examination
[x] Fine and/or imprisonment

In which instances do you have to approach a pedestrian crossing with particular care?

@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 3, 2024 15:15
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
@mo124679
mo124679 / RosaryApp.java
Created May 3, 2024 15:13
The Rosary (Counting) application is primitive and is being developed
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class RosaryApp {
private JFrame frame;
private JButton countButton;
private JLabel countLabel;
private int count = 0;
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@christiangenco
christiangenco / download website assets
Created January 20, 2014 23:23
Use wget to download a website's assets, including images, css, javascript, and html. From http://www.linuxjournal.com/content/downloading-entire-web-site-wget
$ wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--domains website.org \
--no-parent \
www.website.org/tutorials/html/
@3rogue
3rogue / 163_lyric_download.js
Last active May 3, 2024 15:11
网易云音乐歌词下载(双语喔)
// ==UserScript==
// @name 网易云歌词下载,可以双语了orz
// @namespace http://suselinks.us
// @description 我只是做了合并了两个脚本的工作,可以直接下载了。
// @description 脚本1:https://greasyfork.org/zh-CN/scripts/10548-%E7%BD%91%E6%98%93%E4%BA%91%E9%9F%B3%E4%B9%90%E4%B8%8B%E8%BD%BD
// @description 脚本2:https://gist.github.com/anonymous/a800677393bbb2dd113a 多谢他们
// @include http://music.163.com/*
// @grant none
// @version 1.2
// ==/UserScript==