This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Very basic Windows Service template - maybe not fully correct/complete but it works. | |
// x86_64-w64-mingw32-gcc -mwindows -municode -O2 -s -o TempLoggerService.exe TempLoggerService.c | |
// SC create TempLoggerService binpath="C:\Temp\TempLoggerService.exe" | |
// SC delete TempLoggerService | |
#include <windows.h> | |
#include <stdio.h> | |
#define SERVICE_NAME L"TempLoggerService" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// x86_64-w64-mingw32-gcc -Wall -shared -O2 -s -o helper.dll helper.c | |
#include <stdio.h> | |
#include <string.h> | |
__declspec(dllexport) __stdcall int proc_sql_modify(char *sql, int size) { | |
strcpy(sql, "NEW SQL HERE"); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function fetchData(url) { | |
try { | |
const response = await fetch(url); | |
if (!response.ok) { | |
throw new Error(`Network response was not ok (status ${response.status})`); | |
} | |
const data = await response.json(); | |
return data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Freestanding with MinGW: | |
// http://nullprogram.com/blog/2016/01/31/ | |
// http://nullprogram.com/blog/2016/02/28/ | |
// https://support.microsoft.com/da-dk/kb/99456 | |
#include <windows.h> | |
int WINAPI mainCRTStartup(void) | |
{ | |
char msg[] = "Hello, world!\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# https://discourse.gnome.org/t/scaling-images-with-cairo-is-much-slower-in-gtk4/7701 | |
# https://blog.gtk.org/2018/03/16/textures-and-paintables/ | |
import gi | |
gi.require_version("Gtk", "4.0") | |
gi.require_version("Gdk", "4.0") | |
gi.require_version("GdkPixbuf", "2.0") | |
from gi.repository import Gtk, Gdk, GdkPixbuf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Log incoming SQL on MySQL server: | |
set global log_output=FILE; | |
set global general_log_file="C:/Test/MySQL.log"; | |
set global general_log=1; | |
-- Turn off: | |
set global general_log=0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo -n "data:"`file --mime-type --brief $1`";base64,"`base64 --wrap=0 $1` >`realpath $1`".b64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Build: x86_64-w64-mingw32-gcc -Wall -mwindows -Os -s -o Keep-Windows-Awake.exe Keep-Windows-Awake.c | |
#include <windows.h> | |
int main() { | |
/* Keep Windows awake for the lifetime of this thread */ | |
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); | |
/* Wait via a messagebox */ | |
MessageBox(NULL, "Windows is now being prevented from falling asleep.\n\nPress OK to end this...", "Keep-Windows-Awake", MB_OK | MB_ICONINFORMATION); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Placeres i ~/.local/share/eog/plugins | |
# Baseret på https://wiki.gnome.org/Apps/EyeOfGnome/Plugins | |
from gi.repository import GObject, Gdk, Gtk, Eog | |
class TextDialog(Gtk.Dialog): | |
def __init__(self, parent, initialtext): | |
Gtk.Dialog.__init__(self, title="My Dialog", transient_for=parent, flags=0) | |
self.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL) | |
self.set_default_size(300, 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Files changed or deleted since checksum creation are noted. | |
# New files are not noted. | |
if [ -z "$1" ]; then | |
DIR=`pwd` | |
else | |
DIR=`realpath $1` | |
fi |
NewerOlder