Skip to content

Instantly share code, notes, and snippets.

View S-ed's full-sized avatar

Alexey Mak S-ed

View GitHub Profile
@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

@archagon
archagon / gdc-downloader.py
Last active March 21, 2024 19:04
A quick and dirty script to download GDC Vault videos.
# GDC Vault videos can't be watched on mobile devices and this is a very sad thing indeed!
# (Note: this has changed for GDC2013, which lets you watch raw MP4 streams. Kudos!)
# This script is designed to circumvent this by downloading the lecture and slideshow
# videos which can then be re-encoded into whatever format you wish. Obviously, you
# won't be able to do this without access to the Vault. This is strictly for the
# convenience of legitimate Vault users!
# Note: this code is rather flimsy and was written as fast as possible for my own personal use.
# The code only works for the most recent GDC Vault videos, since they all use the same player
# format. If the XML format used to run the player is changed (as it has in the past), the code
@steelywing
steelywing / google-translate-tooltip.user.js
Last active October 22, 2023 16:18
google translate tooltip for firefox & chrome
// ==UserScript==
// @name Google Translate Tooltip
// @namespace steely.wing
// @version 1.10
// @description Translates selected text into a tooltip.
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @copyright 2014, Wing Leong (http://steelywing.iblogger.org/)
// @include *
// @require http://code.jquery.com/jquery-2.1.0.min.js
// @grant GM_getValue
#include <iostream>
#include <fstream>
#include <memory>
#include <string>
#include <algorithm>
void process_crypt_table(unsigned *crypt_table)
{
for (auto i = 0; i < 227; i++)
{
@phosphoer
phosphoer / SimpleGeo.cs
Last active March 28, 2024 22:24
Simple Geometry Painter for Unity
// The MIT License (MIT)
// Copyright (c) 2016 David Evans @phosphoer
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
@SpineyPete
SpineyPete / tonemappers.glsl
Last active November 2, 2023 13:20
Tonemappers
#version 330
// Tonemapping
// -----------
// Some of these are attributed to certain games.
// But this is mostly secondhand info, so take it with a grain of salt.
vec3 Tonemap_Reinhard(vec3 x) {
// Simplest Reinhard tonemapper.
@SvenKortekaas
SvenKortekaas / installation_naskit_nanopi.md
Last active May 28, 2022 06:45
Setting up 1-bay NAS Kit v1.2 for NanoPi NEO&NEO2

Build your own NAS storage

Aluminum Case | OpenMediaVault Ready | NanoPi NEO-512M Applicable

Credit, text from: http://www.friendlyarm.com/index.php?route=product/product&product_id=192&search=nas&description=true&category_id=0&sub_category=true

Image 1/14

The NanoPi NEO and NanoPi NEO2 are pin-to-pin compatible super-mini ARM computers released by FriendlyElec. The NanoPi NEO uses Allwinner's quad-core Cortex-A7 H3 SoC while the NanoPi NEO2 usus Allwinner's 64-bit quad-core Cortex-A53 H5 SoC. Both have onboard Ethernet and USB.

The 1-bay NAS Dock V1.2 for NanoPi NEO&NEO2 uses high speed USB 3.0 to SATA chip JMS567. It has an onboard RTC battery. It works with the latest mainline kernal Linux-4.11 and Debian8-Jessie.

// ==UserScript==
// @name sketchfab2obj
// @description Save Sketchfab models as obj
// @author <anonimus>
//
// Version Number
// @version 1.62
//
// Urls process this user script on
// @include /^https?://(www\.)?sketchfab\.com/models/.*
param (
[String]$LanguageToFix = 'en-SG'
)
$lng = Get-WinUserLanguageList
$lng.Add($LanguageToFix)
Set-WinUserLanguageList -Force $lng
$lng.Remove( ( $lng | Where-Object LanguageTag -like $LanguageToFix ) ) 2>&1 | Out-Null
Set-WinUserLanguageList -Force $lng
@sfider
sfider / DataGameViewportClient.cpp
Last active May 4, 2024 17:26
UE4 Pixel Perfect GameViewportClient
#include "DataGameViewportClient.h"
#include "Engine.h"
#include "Engine/LocalPlayer.h"
#include "SceneView.h"
constexpr int RENDER_WIDTH = 320;
constexpr int RENDER_HEIGHT = 180;
UDataGameViewportClient::UDataGameViewportClient(FVTableHelper& Helper)
: Super(Helper)