Skip to content

Instantly share code, notes, and snippets.

View goldbattle's full-sized avatar

Patrick Geneva goldbattle

View GitHub Profile
@jboner
jboner / latency.txt
Last active November 18, 2024 08:23
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
@simonlynen
simonlynen / detect_arm_cmake
Created May 8, 2013 12:27
detect arm cmake
IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
add_definitions (-mfloat-abi=softfp -mfpu=neon)
ELSE(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
ENDIF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
@L422Y
L422Y / multisync.sh
Last active February 21, 2021 23:57
lftp script to mirror remote ftp site to local folder using multiple connections per file and parallel file downloads (for reference/cron jobs)
#!/bin/bash
do_multisync() {
remote_dir="private/files"
local_dir="/root/i_drive/files"
# remote host
host="ftp.myremotehost.com"
# username / password
user="larry"
@goldbattle
goldbattle / java_conventions.md
Last active January 20, 2023 07:19
Java Coding Conventions

Coding Conventions

This file will cover important coding practices that are important to stress when coding this program. Listed below are some of the more important details that should be stressed. Each programmer has his/her own way to deliver code. The importance of having similar coding conventions throughout this program are listed below.

  • 80% of the time spent on a piece of software goes to maintenance.
  • Hardly any software is maintained for its whole life by the original author.
  • Code conventions improve the readability of the software, allowing engineers to understand new code more quickly and thoroughly.
  • If you ship your source code as a product, you need to make sure it is as well packaged and clean as any other product you create.
@shri
shri / pokemon.json
Last active October 21, 2023 16:31
JSON of pokemon to go with my pokemonMoves.json file
{
"1":{
"name":"Bulbasaur",
"attack":49,
"defense":49,
"evolveLevel":16,
"evolveTo":"2",
"type":"grass",
"moves":[
"tackle",
@ranacseruet
ranacseruet / VideoStream.php
Last active October 30, 2024 12:43
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@yvt
yvt / Spline.h
Created June 22, 2014 11:07
Spline interpolation routines for C++
//
// YSpline (MIT license) by yvt <[email protected]>
//
// -------------
// Quaternion spline interpolation is based on http://qspline.sourceforge.net/qspline.pdf
// -------------
//
#include <functional>
#include <valarray>
@govert
govert / GpsUtils.cs
Last active October 15, 2024 07:26
Convert WGS-84 geodetic locations (GPS readings) to Cartesian coordinates in a local tangent plane (Geodetic to ECEF to ENU)
using System;
using System.Diagnostics;
using static System.Math;
// Some helpers for converting GPS readings from the WGS84 geodetic system to a local North-East-Up cartesian axis.
// The implementation here is according to the paper:
// "Conversion of Geodetic coordinates to the Local Tangent Plane" Version 2.01.
// "The basic reference for this paper is J.Farrell & M.Barth 'The Global Positioning System & Inertial Navigation'"
// Also helpful is Wikipedia: http://en.wikipedia.org/wiki/Geodetic_datum
@phalt
phalt / main.go
Created December 3, 2014 14:51
Simple HTTP API in Go
package main
import (
"github.com/gin-gonic/gin"
"database/sql"
"github.com/coopernurse/gorp"
_ "github.com/mattn/go-sqlite3"
"log"
"time"
"strconv"
@MineTheCube
MineTheCube / mc-api.php
Last active June 11, 2024 14:32
PHP functions to convert UUID to/from Minecraft username
<?php
/**
* Get UUID from Username
*
* @param string $username
* @return string|bool UUID (without dashes) on success, false on failure
*/
function username_to_uuid($username) {
$profile = username_to_profile($username);