Skip to content

Instantly share code, notes, and snippets.

View orklann's full-sized avatar
🏠
Working from home

rkt orklann

🏠
Working from home
View GitHub Profile
@orklann
orklann / speedtest.md
Created April 30, 2017 05:55
Test VPS speed with Speedtest

Download speedtest script

wget https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py

Run default test

Python speedtest.py

List specify test servers

Python speedtest.py --list | grep Beijing

Sample output

#!/bin/bash
#Variables
IP=$(hostname -I | awk '{print $2}')
PasswordGenerator=$(</dev/urandom tr -dc '[:alnum:]' | head -c15; echo "")
PSK=$(openssl rand -base64 24)
export DEBIAN_FRONTEND=noninteractive
#Set proper mirrors
mv /etc/apt/sources.list /etc/apt/sources.list_backup
@orklann
orklann / BBC-Radio-HLS-UK.m3u
Created June 19, 2022 06:08 — forked from bpsib/BBC-Radio-HLS.m3u
BBC Radio Streams
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_med/ak/bbc_radio_one.m3u8
#EXTINF:-1,BBC - Radio 1Xtra
http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_med/ak/bbc_1xtra.m3u8
#EXTINF:-1,BBC - Radio 1Dance
http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_med/ak/bbc_radio_one_dance.m3u8
#EXTINF:-1,BBC - Radio 1Relax
http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_med/ak/bbc_radio_one_relax.m3u8
#EXTINF:-1,BBC - Radio 2
[
{
"name": "NHK FM",
"status": "ACTIVE",
"country_code": "jp",
"country_name": "Japan",
"streams": [
{
"quality": 0,
"url": "https://nhkradioakfm-i.akamaihd.net/hls/live/512290/1-fm/1-fm-01.m3u8"
@orklann
orklann / mac-enable-libfuzzer.md
Created February 20, 2022 03:33 — forked from mcandre/mac-enable-libfuzzer.md
macOS Enable libFuzzer
  1. Run brew install llvm --HEAD.
  2. Update certain shell variables:
# Prefer newer LLVM with fuzzing enabled
# shellcheck source=/dev/null
export CC='clang'
export CXX='clang++'
export LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
PATH="$(brew --prefix)/opt/llvm/bin:$PATH"
@orklann
orklann / 32.asm
Last active February 10, 2022 14:11 — forked from FiloSottile/32.asm
NASM Hello World for x86 and x86_64 Intel Mac OS X(get yourself an updated nasm with brew)
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4
@orklann
orklann / gdcc.py
Created October 28, 2021 08:38
Generating .clang_complete for current folder
#!/usr/bin/env python3
import os
def walk_through_files(path, file_extension='.h'):
for (dirpath, dirnames, filenames) in os.walk(path):
for filename in filenames:
if filename.endswith(file_extension):
yield os.path.join(dirpath, filename)
current_dir = os.getcwd()
for fname in walk_through_files(current_dir):
@orklann
orklann / config
Created October 24, 2021 13:58
cargo behid proxy (~/.cargo/config)
[http]
proxy = "http://127.0.0.1:4780"
[https]
proxy = "https://127.0.0.1:4780"
@orklann
orklann / install_diablo2_on_mac.md
Last active September 7, 2021 08:18 — forked from whipowill/install_diablo2_on_mac.md
Install Diablo II on Mac OSX

Install Diablo II on Mac OSX

These are the instructions for using Terminal to install the Windows version of the game onto your machine. You can then easily copy the game multiple times for different mods you might want to play.

In this guide you'll end up with:

  • A version of the unadulterated game
  • A single-player install w/ PlugY

Install Wine

Real depth in OpenGL / GLSL

http://olivers.posterous.com/linear-depth-in-glsl-for-real

So, many places will give you clues how to get linear depth from the OpenGL depth buffer, or visualise it, or other things. This, however, is what I believe to be the definitive answer:

This link http://www.songho.ca/opengl/gl_projectionmatrix.html gives a good run-down of the projection matrix, and the link between eye-space Z (z_e below) and normalised device coordinates (NDC) Z (z_n below). From there, we have

A   = -(zFar + zNear) / (zFar - zNear);

B = -2zFarzNear / (zFar - zNear);