Skip to content

Instantly share code, notes, and snippets.

View vladkosarev's full-sized avatar

Vlad Kosarev vladkosarev

  • Toronto, Canada
View GitHub Profile
@vladkosarev
vladkosarev / void-wsl.txt
Created October 31, 2024 18:00 — forked from kmatt/void-wsl.txt
Install Void Linux on WSL2
# Based on https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5
# prompt ">" indicates Powershell commands
# prompt "$" are Linux shell commands
# https://docs.microsoft.com/en-us/windows/wsl/install-win10
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
@vladkosarev
vladkosarev / UUID_v7_for_Postgres.sql
Created February 17, 2023 15:34 — forked from kjmph/A_UUID_v7_for_Postgres.sql
Postgres PL/pgSQL function for UUID v7 and a bonus custom UUID v8 to support microsecond precision as well. Read more here: https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
create or replace function uuid_generate_v7()
returns uuid
as $$
declare
unix_ts_ms bytea;
uuid_bytes bytea;
begin
unix_ts_ms = substring(int8send(floor(extract(epoch from clock_timestamp()) * 1000)::bigint) from 3);
@vladkosarev
vladkosarev / boxstarter.ps1
Created July 11, 2018 13:31 — forked from ElJefeDSecurIT/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: ElJefeDSecurIT
# Last Updated: 2017-10-10
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@vladkosarev
vladkosarev / boxstarter.ps1
Created June 8, 2018 18:21 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <[email protected]>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@vladkosarev
vladkosarev / fs-tail.fsx
Created February 22, 2017 00:02
File tail script in F#. Run with - fsi fs-tail.fsx <folder> <file>, i.e fsi fs-tail.fsx . test.log
open System.IO
open System
let args = fsi.CommandLineArgs
let watcher = new FileSystemWatcher(Path = args.[1], Filter = args.[2], EnableRaisingEvents = true)
let fullPath = Path.Combine(args.[1], args.[2])
let stream = File.Open(fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
stream.Seek(0L, SeekOrigin.End)
printfn "Watching %s" fullPath
let sr = new StreamReader(stream)
//==========================================
// Working fully self-contained getting-started example for Suave Web Server scripting
//
// Note you don't need to have _anything_ installed before starting with this script. Nothing
// but F# Interactive and this script.
//
// This script fetches the Paket.exe component which is referenced later in the script.
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been
// downloaded by the user (by executing the first part of the script) the reference
// shows as resolved and can be used.
@vladkosarev
vladkosarev / azureservicebustest.cs
Created February 2, 2014 02:26
Fooling around with Azure Service bus queues and dead lettering
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using Microsoft.WindowsAzure;
using System;
using System.Threading;
namespace AzureServiceBusTest
{
class Program
{
@vladkosarev
vladkosarev / AzureDeadLetterTest.cs
Created January 27, 2014 16:24
Azure Service Bus Dead Letter Queue Test
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using Microsoft.WindowsAzure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@vladkosarev
vladkosarev / transform.js
Last active December 17, 2015 15:19
Filter out RavenDB Replication metadata during a Smuggler transform (required RavenDB 2.5)
function(doc) {
delete doc['@metadata']['Raven-Replication-Version'];
delete doc['@metadata']['Raven-Replication-Source'];
delete doc['@metadata']['Raven-Replication-History'];
return doc;
}
@vladkosarev
vladkosarev / ieConsoleFix.js
Last active December 16, 2015 10:29
console.log is undefined in IE until you open debugging window. To have the site work without dev tools open we overwrite console if it doesn't exist.
// IE console.log fix
if (typeof console === "undefined" || typeof console.log === "undefined") {
console = {};
console.log = function () { };
}