Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / index.html
Created September 8, 2015 18:06
JS Bin // source http://jsbin.com/yelehizudo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
body, canvas {
width: 100%;
height: 500px;
}
@gtcarlos
gtcarlos / github_repo
Created May 18, 2015 12:56
Create Github repositories from command line
#!/usr/bin/env ruby
# encoding: UTF-8
user = '<YOUR USERNAME HERE>'
puts 'Repository Name:'
name = gets.chomp
puts 'Repository Description:'
description = gets.chomp
@Taytay
Taytay / install_hub.sh
Created June 26, 2018 19:12
Install latest version of Github's hub on Linux
#!/bin/bash
# Installs latest release of hub on Linux
# Echo, halt on errors, halt on uninitialized ENV variables. (https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/)
set -euxo pipefail
# Hub doesn't have a way to install the latest version using `apt` yet, so I wrote this as a hacky substitute.
# This will be unnecessary when this issue is resolved: https://github.com/github/hub/issues/718#issuecomment-65824284
# Linux options include:
@rnapier
rnapier / fix-xcode
Last active March 18, 2022 01:17
Links Xcode SDKs from the /SDKs directory (which you maintain yourself)
#!/usr/bin/python
# fix-xcode
# Rob Napier <robnapier@gmail.com>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
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 µ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 4X memory

import os
import time
import shutil
import argparse
# Create the argument parser
parser = argparse.ArgumentParser(description='Pico Firmware Flasher')
parser.add_argument('uf2_file_path', metavar='UF2_FILE', type=str, help='Path to the UF2 file')
parser.add_argument('-d', '--drive_letter', type=str, default='D:', help='Drive letter of the Pico (default: D:)')
@gustavolaureano
gustavolaureano / main.py
Created August 4, 2023 20:15
MicroPython code for the raspberry pico to count how many WS2812 are connected, the data signal of the LEDs must be connected to GP2 and the ADC (GP26) must be connected to the strip ground after a jump wire (I used a cheap 20cm jumper cable), using the jumper as a shunt
import machine, neopixel, time
from machine import Pin, ADC
np = neopixel.NeoPixel(Pin(2), 200)
adcpin = machine.ADC(26)
while True:
num_of_leds = None
for i in range(len(np)):
onvalue = 0
import os
import time
import shutil
import subprocess
import signal
import sys
import argparse
#If the applescript stops working or you don't want the function, set enableapplescript to False
enableapplescript = True
@m-ou-se
m-ou-se / replace-debian-with-arch.txt
Last active October 22, 2023 12:16
Instructions to replace a live Debian installation with Arch
# Download latest archlinux bootstrap package, see https://www.archlinux.org/download/
wget 'ftp://ftp.nluug.nl/pub/os/Linux/distr/archlinux/iso/latest/archlinux-bootstrap-*-x86_64.tar.gz'
# Make sure you'll have enough entropy for pacman-key later.
apt-get install haveged
# Install the arch bootstrap image in a tmpfs.
mount -t tmpfs none /mnt
cd /mnt
tar xvf ~/archlinux-bootstrap-*-x86_64.tar.gz --strip-components=1
@PayasR
PayasR / routing_algorithm_implementations.txt
Last active December 25, 2023 08:52 — forked from systemed/gist:be2d6bb242d2fa497b5d93dcafe85f0c
Routing algorithm implementations
**Interesting/widely used implementations of pathfinding algorithms.
==========================================================================
A* Ruby https://github.com/georgian-se/shortest-path
A* (bidirectional with shortcuts) C++ https://github.com/valhalla/valhalla
A* Unity https://arongranberg.com/astar/front
NBA* JS https://github.com/anvaka/ngraph.path
NBA* Java https://github.com/coderodde/GraphSearchPal
NBA* Java https://github.com/coderodde/FunkyPathfinding
NBA* (Parallel) C++ https://github.com/janhsimon/PNBAStar