Skip to content

Instantly share code, notes, and snippets.

View ndastur's full-sized avatar

Neville Dastur ndastur

  • Clinical Software Solutions
View GitHub Profile
@ndastur
ndastur / spectre.c
Created January 6, 2018 12:35 — forked from ErikAugust/spectre.c
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@ndastur
ndastur / gist:fb997265efd5042aba14c995de3a5407
Created July 12, 2019 00:26
PostgreSQL - Generate a short GUID in a column
CREATE EXTENSION IF NOT EXISTS "hstore";
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE TABLE IF NOT EXISTS tbl (
t_id serial PRIMARY KEY
,txt text
,shortid text
);
@ndastur
ndastur / preRequestScript.js
Created July 24, 2019 23:50 — forked from ptrstpp950/preRequestScript.js
Calculate TOTP in Postman
//Article about TOTP on my blog https://stapp.space/generate-totp-in-postman/
/**
* @preserve A JavaScript implementation of the SHA family of hashes, as
* defined in FIPS PUB 180-4 and FIPS PUB 202, as well as the corresponding
* HMAC implementation as defined in FIPS PUB 198a
*
* Copyright Brian Turek 2008-2017
* Distributed under the BSD License
* See http://caligatio.github.com/jsSHA/ for more information
@ndastur
ndastur / pg_table_fields_dump.txt
Last active February 23, 2020 01:39
Output list of Postgresql tables and their fields on a single bash line
PGUSER=<user> PGPASSWORD=<pw> PGHOST=<host> PGDATABASE=<database> bash -c 'psql -Atc "select tablename from pg_tables where schemaname='\''public'\''" $PGDATABASE | while read TBL; do echo \"$TBL\": { \"keyFields\": [ ; psql -c "COPY (select * from public.$TBL where false) TO STDOUT WITH (FORMAT CSV, HEADER, DELIMITER '\'','\'')" $PGDATABASE | sed '\''s/[^,]*/"&"/g'\'' ; echo ] }, ; done