Skip to content

Instantly share code, notes, and snippets.

View stijnsanders's full-sized avatar

Stijn Sanders stijnsanders

View GitHub Profile
@stijnsanders
stijnsanders / fixdpb.dpr
Created September 23, 2023 20:07
(Ab)Use the Delphi IDE to get your project built, but still get the output over standard out.
program fixdpb;
{$APPTYPE CONSOLE}
uses
Windows,
SysUtils,
Classes;
var
@stijnsanders
stijnsanders / DelphiWIATakePicture
Created February 2, 2012 16:17
Delphi: WIA to take image from digital Camera connected to USB
uses WIALib_TLB;
procedure TForm1.Button1Click(Sender: TObject);
var
wia:IWia;
wiad:OleVariant;
wiax:IWiaDispatchItem;
i:integer;
tc1,tc2:cardinal;
begin
unit WinHttpWS;
interface
uses Windows;
const
// flags for WinHttpOpen
WINHTTP_FLAG_ASYNC = $10000000; // this session is asynchronous (where supported)
WINHTTP_FLAG_SECURE_DEFAULTS = $30000000; // note that this flag also forces async
@stijnsanders
stijnsanders / pxsvg.dpr
Last active June 17, 2021 21:42
quick and dirty conversion of png to svg
program pxsvg;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
pxsvg1 in 'pxsvg1.pas';
@stijnsanders
stijnsanders / SmartPort.pas
Created March 3, 2017 15:29
SmartPort: bare-bones wrapper for a serial connection (with some USB support)
unit SmartPort;
interface
uses Windows, SysUtils, Classes;
{$D-}
type
TSmartPortParity=(ppParityEven,ppParityMark,ppParityNone,ppParityOdd,ppParitySpace);
@stijnsanders
stijnsanders / gmail.css
Last active January 20, 2021 10:24
personal CSS for Stylish to apply to GMail (see also http://yoy.be/GMailLargerLabelsMenu.html
BODY,
INPUT,
TD {
font-family: "PT Sans", sans-serif;
line-height: 1.12;
}
.G-atb{
height:32px;
}
.Wg {
@stijnsanders
stijnsanders / PdfParser.pas
Created October 27, 2014 12:09
Minimal PDF parser to extract text of first page
unit PdfParser;
interface
uses SysUtils, Classes;
type
TPdfDocument=class;//forward
TPdfDataBlockType=(dbtDictionary,dbtArray,dbtSingleValue);
@stijnsanders
stijnsanders / Ping2.pas
Created February 8, 2019 11:41
Ping2.pas
unit Ping2;
interface
function PingHost(const HostName:string;TimeoutMS:cardinal=500):boolean;
implementation
uses Windows, SysUtils, WinSock, Sockets;
@stijnsanders
stijnsanders / SendSMS.pas
Created March 3, 2017 15:27
Send SMS over 'USB modem' connected mobile phone
unit SendSMS;
interface
procedure DoSendSMS(const ToNr,Msg:string);
implementation
uses Windows, SysUtils, Classes, Registry, SmartPort;
@stijnsanders
stijnsanders / sortable.html
Created July 19, 2013 15:30
A simple straightforward sortable table in JavaScript
<style><!--
TABLE,P {padding:0.2em;}
TH {padding: 0.2em;border:1px solid green;}
TH.sorted_up {background-color:#CFC;}
TH.sorted_down {background-color:#FCC;}
TD {padding: 0.2em;border:1px solid blue;}
TD.n {text-align:right;}
//--></style>
<table id="sortable" cellspacing="0" cellpadding="2">