Skip to content

Instantly share code, notes, and snippets.

View bhrgu's full-sized avatar

Alexander Kompaniets bhrgu

  • Moscow, Russia
View GitHub Profile
@bhrgu
bhrgu / vax.md
Created October 30, 2017 19:05
Resetting a password for SYSTEM account in VAX/VMS

Resetting a password for SYSTEM account in VAX/VMS

Note: you must be connected to a system via serial console

  1. Type following commands in boot console to perform a conversational boot:
B /R5:1 DKA300
SET/STARTUP OPA0:
SET WINDOW_SYSTEM 0
SET WRITESYSPARAMS 0
CONTINUE
@bhrgu
bhrgu / HTTP_Basic_Auth.ps1
Last active November 1, 2017 05:58
Basic HTTP auth with Powershell example
$username='admin'
$password='s3cr3t'
$WebResponce = Invoke-WebRequest -Uri "http://192.168.1.1/" `
-Headers @{"Authorization" = "Basic "+[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($username+":"+$password))} `
-OutFile .\pstest.txt
@bhrgu
bhrgu / read_kv_config.cmd
Created October 30, 2017 14:18
Read key-value config file with good old cmd :)
@ECHO OFF
SET CONFIGFILE=config.txt
REM Create the key-value config file
ECHO #Simple key-value config > %CONFIGFILE%
ECHO Key1=Value1 >> %CONFIGFILE%
ECHO Key2=Value2 >> %CONFIGFILE%
REM Read keys and setting values
@bhrgu
bhrgu / UPDATE_with_JOIN_example.sql
Created October 30, 2017 13:29
An example of using UPDATE with JOIN
USE TestDatabase
/* Create tables */
CREATE TABLE [dbo].[TParent](
[id] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY,
[name] [nvarchar](300) NULL
)
CREATE TABLE [dbo].[TChild](
[id] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY,
@bhrgu
bhrgu / fn_GetUnixTimestamp.sql
Created October 30, 2017 11:21
T-SQL UNIX timestamp function
/* Create function */
CREATE FUNCTION [dbo].[fn_GetUnixTimestamp]
(
@CT DATETIME
)
RETURNS BIGINT
AS
BEGIN
DECLARE @CTS BIGINT
SELECT @CTS = (CAST(DATEDIFF(second, '1970-01-01', CAST(GetUtcDate() AS date)) AS bigint)*1000)