Category Archives: Reference

Short references for personal… reference. Basically a howto for the tech-savvy.

Find and kill long running MS SQL Server queries

I have to admit this is cargo cult SQL to me, but here’s how to find running queries, sorted by their total elapsed time: SELECT [sqltext].[TEXT], [req].[session_id], [req].[status], [req].[command], [req].[cpu_time], [req].[total_elapsed_time] FROM [sys].[dm_exec_requests] [req] CROSS APPLY [sys].[dm_exec_sql_text](sql_handle) AS sqltext ORDER BY [req].[total_elapsed_time] DESC To kill a given query, use: kill <session_id> ..without the brackets <>, […]

Squid Compile with SSL support under Debian Jessie

Here’s how: apt-get update # install required dev packages apt-get install -y openssl devscripts build-essential libssl-dev # install debian squid3 source code apt-get source -y squid3 # install all required dependeny packages apt-get build-dep -y squid3 # reconfigure cd squid3-3.4.8/ vi debian/rules root@jessie:~/squid3-3.4.8# diff /tmp/rules debian/rules 46c46,48 < –with-default-user=proxy — > –with-default-user=proxy \ > –enable-ssl […]

A few group policies I use on Windows 10

Disable the lock screen, always showing a login prompt: Group Policy Editor (gpedit.msc) => Computer Configuration => Administrative Templates => Control Panel => Personalization => Do not display the lock screen Disallow the use of OneDrive: Group Policy Editor (gpedit.msc) => Computer Configuration => Administrative Templates => Windows Components => OneDrive => Prevent the usage […]

Wiping an (Azure) SQL Server database, deleting all tables

Just for personal reference USE [mydb] GO WHILE(EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE=’FOREIGN KEY’)) BEGIN DECLARE @sql0 NVARCHAR(2000) SELECT TOP 1 @sql0=(‘ALTER TABLE [‘ + TABLE_SCHEMA + ‘].[‘ + TABLE_NAME + ‘] DROP CONSTRAINT [‘ + CONSTRAINT_NAME + ‘]’) FROM information_schema.table_constraints WHERE CONSTRAINT_TYPE = ‘FOREIGN KEY’ EXEC (@sql0) PRINT @sql0 END GO DECLARE @sql1 NVARCHAR(2000) […]

Mounting and using KVM raw image files on the host system

Boldly stolen from David Champion at the University of Chicago, and archived for personal reference. All credits to that page. kpartx will scan a block device — e.g., your /dev/loop0 — and create device-mapped specials under /dev/mapper for the partitions. Then you can address individual partitions. (N.B.: When done, before you can losetup -d the […]

Tool tip: “vbetool” runs real-mode video BIOS code to alter hardware state

This is so damn useful to turn on and off remote displays through SSH, for wall-mounted information screens and similar. Available in your friendly neighbourhood Linux distribution. VBETOOL(1) User Commands VBETOOL(1) NAME vbetool – run real-mode video BIOS code to alter hardware state SYNOPSIS vbetool [[vbestate save|restore]|[vbemode set|get]|[vgamode]|[dpms on|off|standby|suspend|reduced]|[post [romfile]]|[vgastate on|off]|[vbefp pan‐ elid|panelsize|getbrightness|setbrightness|invert]] DESCRIPTION vbetool […]

Aeon Cobra 50cc (GOES 50s) service manuals and parts lists

Something completely unrelated to this blog thing, but I feel I have to put it somewhere. I recently did some mechanical work on an Aeon Cobra 50cc (AT70 in the registration) and spent a few evenings looking up information about it. The Aeon Cobra 50cc is sold in several Nordic countries as the GOES 50s. […]