Skip to content

Instantly share code, notes, and snippets.

@dreamlayers
dreamlayers / testfullscreen.c
Created December 11, 2022 20:36
Emscripten SDL 2 full screen test.
#include <emscripten/emscripten.h>
#include "SDL.h"
SDL_Window *window = NULL;
SDL_Renderer *renderer = NULL;
SDL_Surface *surface;
//#define USE_SURFACE
/* If window lacks SDL_WINDOW_RESIZABLE, then after exiting from full screen
@dreamlayers
dreamlayers / uudecode.com.txt
Created April 21, 2021 18:05
Printable UUDECODE.COM for MS-DOS. (Not mine. Useful for sending files via serial port. Remember ctty com1.)
XP[@PPD]5`P(f#(f((f?5!QP^P_u!2$=po}l=!!rZF*$*$ =0%GF%!!%PP$P$Ps-
%gmZ$rl6lW$rm6mWlVl6m=ldmAlv%fmvmB$Vm6lW$Vm6mWl6m6m=ld%ylVmqlJmq
lRmqlNmqlBlWl6m6l/m'l/m3mWl7m7mrm4mql:lXl7m7mAl2mA%cln%n$[$Z%X$X
l&$_%^$\%`l&%`$Y$Y%[$Y${%k%X$X$Z%X$Xl&$_%^$\%`l&%`$Y$Y%[$Y${%Y$X
%b$Y$Xl&$[%[$Xl&$_%[%X$[$`${%p$[$`l&$[%[$Xl&$_%[%X$[$`${l&%`$V%^
%Y$X%Y${l&%r$a%[$Y$X%^$[%_m&l6l6l6l6l`m5l`m5$dm5l6lBl9m6lB$hm6mW
$dm5lBmNl6m`%t$a%`%Xl<m`%t%_%^%Xl?m`%t$[l&%XlBmW$dm5l\l&l`$ulT$W
m9l`$ulT%Xm9l`$ulT$Wm9$ulT$Xl4lal`mAl:lY$dm5%ymRlrm0lv$s$bm6m7$X
l'l\$kmPm&$tl5$Xl+$tl-$Xl-mqmOm!lQlB%{m6lY$pm6mZl-l6l^m4mBl+m6l\
$tmPm&%Ym5mBmEl6me$fm6mW$dm5lB%`l6l`l1lV$X$nmYl&l&l!mUl1lV$X%s$y
@dreamlayers
dreamlayers / mathmono.py
Created October 14, 2016 15:58
Transform text to math monospace
#!/usr/bin/env python3
import sys
def mathmono(s):
res = ''
for c in s:
cn = ord(c)
if cn >= ord('a') and cn <= ord('z'):
cn += 0x1D68A - ord('a')
@dreamlayers
dreamlayers / pan2csv.py
Created June 21, 2016 00:30
Download photo information for a user from Panoramio and save it to a CSV file
#!/usr/bin/env python3
# Program for downloading photo information for a user from Panoramio
# and saving it to a CSV file.
# By Boris Gjenero <boris.gjenero@gmail.com>
#
# This program makes requests to Panoramio servers for every single photo.
# That's not very efficient. Don't run this often. It is meant for occasional
# personal backup purposes.
#
# Also see https://dreamlayers.blogspot.ca/2009/12/downloading-photos-coordinates-titles.html
@dreamlayers
dreamlayers / aud-view-dir.cc
Last active April 6, 2016 19:35
Audacious plugin for opening folder containing playlist files in KDE Dolphin file browser
/*
* aud-view-dir.cc - An Audacious plugin for opening the folder where files in
* the playlist are located. Currently supports KDE Dolphin.
*
* Build with: g++ -Wall -std=c++11 -fPIC -shared aud-view-dir.cc $(pkg-config gtk+-2.0 audacious --cflags --libs) -o aud-view-dir.so
*
* Copy .so file into system Audiacious plugin directory, because
* plugins in ~/.local aren't loaded by Audacious anymore.
*
* Copyright 2015 Boris Gjenero
@dreamlayers
dreamlayers / mspremote.c
Created October 13, 2014 20:48
NEC remote control protocol receiver for MSP430
/* mspremote - NEC remote control protocol receiver for MSP430 */
/* by Boris Gjenero <boris.gjenero@gmail.com> */
#include <stdbool.h>
#include <msp430.h>
#include <msp430g2252.h>
#define P1_LED1 0x01
#define P1_REMOTE 0x10
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <SDL/SDL.h>
#ifdef EMSCRIPTEN
#include <emscripten.h>
#else
#include <unistd.h>
#endif
diff --git a/src/library_sdl.js b/src/library_sdl.js
index 80734d9..7bed46c 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -1723,6 +1723,7 @@ var LibrarySDL = {
SDL.audio.pushAudio=function(ptr,sizeBytes) {
try {
--SDL.audio.numAudioTimersPending;
+ if (SDL.audio.paused) return;
#!/usr/bin/python
# decatchify.py : Script for removing exception catching from MESS
# *** Configuration ***
# List of filenames to not process
WHITELIST = (
'machine.c' # Contains running_machine::start_all_devices()
)
@dreamlayers
dreamlayers / gist:8463670
Created January 16, 2014 21:22
This is an improper fix for Emscripten relooper issue #1909, which is good enough for DOSBox. It avoids creating long chains of comparisons for switch statements, and greatly improves DOSBox performance in Firefox. This can generate assertion failures and JavaScript errors when running the relooper fuzzer. I have not observed any improperly runn…
diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp
index de69e0e..ee3aedc 100644
--- a/src/relooper/Relooper.cpp
+++ b/src/relooper/Relooper.cpp
@@ -556,7 +556,7 @@ void Relooper::Calculate(Block *Entry) {
for (BlockSet::iterator iter = Curr->BranchesIn.begin(); iter != Curr->BranchesIn.end(); iter++) {
Queue.insert(*iter);
}
-#if 0
+#if 1