Skip to content

Instantly share code, notes, and snippets.

@davegurnell
davegurnell / GLTest.java
Created July 15, 2012 09:28
LWJGL OpenGL version test case
import org.lwjgl.*;
import org.lwjgl.opengl.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.GL20.*;
import static org.lwjgl.opengl.GL30.*;
import static org.lwjgl.util.glu.GLU.*;
import static org.lwjgl.BufferUtils.*;
public class GLTest {
@baetheus
baetheus / README.md
Last active December 17, 2023 14:28
SmartOS Single IP with NAT using VLAN

WARNING

These intructions might work, but they need a bit of attention. I've been reading through ipf and smf documentation and have found a few ways to improve this process. When I have time I'll add that information here, until then, be sure to look into the ipf settings if you're having issues with routing. Good luck!

Foreword

This is a modified version of sjorge's instructions for Single IP with NAT. Those instructions can be found here: https://docu.blackdot.be/snipets/solaris/smartos-nat

The primary difference is that this version does not rely on etherstubs for internal switching, but instead uses a vlan configuration. The benefits of this method over using etherstubs are:

  1. Project Fifo (project-fifo.net) can create vms and zones with vlans, but does not currently have etherstub support.
  2. Vlan switching is supposedly more efficient than creating an etherstub to handle switching. I have not tested this statement.
@uucidl
uucidl / 00-notes-about-APIs.org
Last active October 18, 2022 09:14
Notes about APIs

On the emergence of interfaces

Interfaces naturally emerge as software gets broken down into parts communicating with one another. The larger and more deliberate structures emerge from a deliberate attempt to organize the development process itself. [fn:Liskov2008] Structure often emerge directly from division of labor: as teams take on independent tasks, interfaces are established betweeen domains they become responsible for. (Conway’s Law)

Software developers are responsible for systems built out of very small atoms while ultimately performing tasks for their users of a much greater magnitude. Dijkstra showed this by computing the ratio between grains of time at the lowest and largest atoms of the system (from say, CPU instructions to a human interaction with the system) The span was already quite large by Dijkstra’s time, of about 10^9. Today this ratio would be at least above 10^12 (see grain ratios)

This large span has to be manage

@jjmalina
jjmalina / debian-8-jessie-lenovo-x1-carbon-4th-gen.md
Last active July 6, 2021 17:45
Installing Debian 8.5 "jessie" on a Lenovo X1 Carbon 4th generation

Installing Debian 8.5 "jessie" on a Lenovo X1 Carbon 4th generation (20FB) - 2016

UPDATE 2018-02-24: I got a new Lenovo X1 Carbon 5th gen and tried to do the same setup with Debian 9.3.0. It was an utter failure because of some boot issues. I went with Xubuntu instead and everything works FLAWLESSLY. Xubuntu is beautiful.

I've had my mind on switching my development machine from a 13" MacBook Pro Retina to a Lenovo X1 Carbon running Linux for a while. The main reason is getting more familiar with Linux itself and also to have a more stable and minimal dev environment. So I finally got the machine and decided to install Debian 8.5 "jessie". Why Debian? Well, I tried installing Arch Linux once and couldn't get past getting wifi to work, and Ubuntu seemed like it added too much stuff. The choice was either Debian or Linux Mint. I went with Debian because it seems like it's the most stable.

Create a bootable USB stick

I followed the instructions at https://www.debian.org/releases/jessie/amd64/ch04s

#ifndef __MG_ED25519_H_INCLUDE_GUARD__
#define __MG_ED25519_H_INCLUDE_GUARD__
//#define MG_ED25519_IMPLEMENTATION exactly once, blah blah
/*
I completely ripped this off of Orson Peters' ed25519 implementation to make it a single file. I added mg_ed25519 prefixes
to everything so it wouldn't pollute the global namespace, but otherwise the code is the same.
The original implementation is here: https://github.com/orlp/ed25519
- Shawn McGrath <@sssmcgrath on twitter>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct ion_type_t ion_type_t;
typedef struct ion_value_t ion_value_t;
typedef struct ion_state_t ion_state_t;
typedef struct ion_instruction_t ion_instruction_t;
typedef void (*ion_operation_t)(ion_state_t *, ion_value_t, ion_value_t, ion_value_t *);
@uucidl
uucidl / 00_ProfilingAndDataAnalysisInSoftware.org
Last active June 1, 2024 08:46
Profiling and data analysis resources

Goals

Looking at software from a different angle as done during profiling and data analysis has numerous benefits. It requires and increases our understanding of the problems being solved by the software. It exposes us to unexpected discoveries and insights. It allows us to suggest improvements.

Since there is a great element of skills involved, and it is rarely taught in Computer Science degrees, the role of practice is very important to gain the necessary skills.

Exercises

Ex1: sequential processing

[Written on Facebook in response to a post by Glenn Fielder.]

I implemented a proof of concept WebRTC server over the Christmas holidays specialized for use by dedicated server games with UDP-based protocols. The ICE/SDP side of things is like 100 lines if you only code the parts you need rather than using libstun or whatever (the server's SDP offer specifies its public IP, so you just have to implement the STUN responses when the client starts to bang on your ports), and you can likewise hard code the tiny subset of SCTP you need for data channels. The only thing you really need external code for is the cryptography for the ICE authentication and for DTLS, where I used mbedtls.

One thing you didn't mention in your article is that WebRTC data channels (i.e. SCTP over UDP) are congestion controlled per WebRTC connection with a TCP-like algorithm even if you set the no-ordering, no-retransmit options, so you can't use them to efficiently tunnel a UDP protocol that wants to do its own congestion control, like

@croepha
croepha / sk_devenv_stop_debug.cpp
Last active May 2, 2017 19:21
Stops the visual studio debugger, useful for putting in your build scripts and avoid the exe file in use issues
#include <stdio.h>
#include <Windows.h>
BOOL EnumWindowsProc_(HWND hwnd, LPARAM lParam ) {
char text_buff[1024] = "";
GetWindowTextA(hwnd, text_buff, sizeof(text_buff));
if (strstr(text_buff, "Microsoft Visual Studio")) {
printf("%p\n", hwnd);
printf("%s\n", text_buff);