Skip to content

Instantly share code, notes, and snippets.

@thales17
thales17 / Embed_lua.c
Last active June 9, 2020 15:43
Embedding Lua Scripts into C programs
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
int count = 0;
void error (lua_State *L, const char *fmt, ...) {
@thales17
thales17 / index.html
Created September 4, 2019 18:55
WebAudio Oscillator Example
<html>
<head>
</head>
<body>
<script type="text/javascript">
@thales17
thales17 / encrypt.js
Last active July 30, 2019 15:53
RSA Public/Private Key Node Go
const crypto = require('crypto');
const fs = require('fs');
buffer = Buffer.from('albuquerque');
fs.readFile('mykey.pub.pem', 'utf8', function(err, data) {
if (err) throw err;
console.log(data);
let key = {key: data, padding: crypto.constants.RSA_PKCS1_PADDING};
let encrypted = crypto.publicEncrypt(key, buffer);
console.log(encrypted.toString('base64'));
@thales17
thales17 / FIX.md
Created July 9, 2019 14:21
Zoom Fix
<!DOCTYPE HTML>
<html>
<head>
<title>Pixi Sine Wave</title>
<style>
body {
margin: 0;
padding: 0;
background-color: #000000;
/* Ported from Fabien Sanglards DoomFirePSX https://github.com/fabiensanglard/DoomFirePSX/blob/master/flames.html */
#include <SDL2/SDL.h>
#include <stdio.h>
#include <stdlib.h>
#define FIRE_WIDTH 320
#define FIRE_HEIGHT 336
SDL_Window *window = NULL;
SDL_Renderer *renderer = NULL;
@thales17
thales17 / sdl_squarewave.c
Last active June 16, 2019 01:32
SDL2 Squarewave
#include <math.h>
#include <SDL2/SDL.h>
struct squarewave {
float phase_inc;
float phase;
float volume;
};
@thales17
thales17 / gitea_migration.py
Created May 14, 2019 19:01
Migration script to upload a large set of repos to github
#!/usr/local/bin/python3
import os
from github import Github
def get_subdirs(p_dir):
return [name for name in os.listdir(p_dir)
if os.path.isdir(os.path.join(p_dir, name))]
@thales17
thales17 / msys2-SDL2-Setup.md
Last active April 14, 2024 07:20
msys2 sdl2 setup

Download and install msys2 64bit

Update msys2

  • Update msys2 64bit after install by running pacman -Syu if pacman needs to be updated you might have to close and reopen the terminal and run pacman -Syu again

Install build tools

  • pacman -S git mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-SDL2 mingw64/mingw-w64-x86_64-SDL2_mixer mingw64/mingw-w64-x86_64-SDL2_image mingw64/mingw-w64-x86_64-SDL2_ttf mingw64/mingw-w64-x86_64-SDL2_net mingw64/mingw-w64-x86_64-cmake make

Compile Hello World

{
"rules": {
"comma-dangle": [2,"only-multiline"],
"no-cond-assign": [2,"always"],
"no-console": 2,
"no-constant-condition": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-dupe-args": 2,
"no-dupe-keys": 2,