Skip to content

Instantly share code, notes, and snippets.

View PaluMacil's full-sized avatar

Dan Wolf PaluMacil

View GitHub Profile
@bnolan
bnolan / container_sdl.cpp
Created April 15, 2017 06:10
SDL Container for litehtml
#include "container_sdl.h"
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
using namespace litehtml;
container_sdl::container_sdl(litehtml::context* html_context, SDL_Renderer* renderer){
@wesbos
wesbos / async-await.js
Created February 22, 2017 14:02
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@peterhellberg
peterhellberg / graceful.go
Last active November 13, 2024 20:20
*http.Server in Go 1.8 supports graceful shutdown. This is a small example.
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
@vinzenz
vinzenz / dial-pq-via-ssh.go
Last active February 24, 2025 10:02
Use postgres via SSH in Golang
package main
import (
"database/sql"
"database/sql/driver"
"fmt"
"net"
"os"
"time"
@sdorra
sdorra / keys.go
Created April 17, 2016 19:31
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@JakubVanek
JakubVanek / Framebuffer to PNG
Last active May 5, 2023 21:10
Convert raw BGRA framebuffer to RGB png file
This program can be used to convert raw BGRA 8888 framebuffer to standard PNG file.
@montanaflynn
montanaflynn / port.go
Created January 7, 2016 08:21
Port package which finds available ports or checks if a port is available
package port
import (
"net"
"strconv"
)
// New gets an available port
func New() (port int, err error) {
@eliotsykes
eliotsykes / git-aware-bash-prompt.md
Last active June 2, 2024 02:26
Git Aware Bash Prompt
@fritzy
fritzy / 1_triggers.sql
Last active March 16, 2025 15:06
Get table change notifications from Postgres as JSON
CREATE OR REPLACE FUNCTION table_update_notify() RETURNS trigger AS $$
DECLARE
id bigint;
BEGIN
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
id = NEW.id;
ELSE
id = OLD.id;
END IF;
PERFORM pg_notify('table_update', json_build_object('table', TG_TABLE_NAME, 'id', id, 'type', TG_OP)::text);
@orlp
orlp / chacha.h
Last active April 27, 2025 05:42
C++11 ChaCha implementation.
/*
Copyright (c) 2024 Orson Peters <[email protected]>
This software is provided 'as-is', without any express or implied warranty. In no event will the
authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial
applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the