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
# 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
import sys | |
import socket | |
import random | |
# Create and bind UDP socket | |
bind_ip = sys.argv[1] | |
bind_port = int(sys.argv[2]) | |
msgsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) | |
msgsock.bind((bind_ip, bind_port)) | |
print('Waiting for commands on', bind_ip, 'port', bind_port) |
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
{ BinSearchReplace Version 0.9 } | |
program BinSearchReplace; | |
{$APPTYPE CONSOLE} | |
{$R *.res} | |
uses | |
Windows, SysUtils; | |
const | |
cFileChunkSize = 500000; |
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 |
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
Create/update the copy: | |
rsync -avi --delete A/ B/ | |
Verify: | |
rsync --dry-run --recursive --checksum --times --delete --itemize-changes --verbose --stats A/ B/ |
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
// 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
#!/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
REM This file is not meant to be run in it's entirety | |
REM --- Check if script is run as administrator | |
net session >nul 2>&1 | |
if %errorlevel% neq 0 ( | |
echo This script must be run with administrator privileges | |
pause | |
exit /B | |
) |
NewerOlder