Skip to content

Instantly share code, notes, and snippets.

View snobu's full-sized avatar

Adrian Calinescu snobu

View GitHub Profile
@snobu
snobu / acquire_cognitive_services_bearer_token.py
Created November 27, 2018 14:11
acquire_cognitive_services_bearer_token.py
import requests
import base64
SUBSCRIPTION_KEY = ''
ISSUE_TOKEN_URL = ''
def get_bearer(SUBSCRIPTION_KEY, ISSUE_TOKEN_URL):
headers = {
'Ocp-Apim-Subscription-Key': SUBSCRIPTION_KEY,
}
@snobu
snobu / hype.go
Created November 12, 2018 11:11
termui and nats demo
package main
import (
"fmt"
"log"
"time"
ui "github.com/gizak/termui"
"github.com/nats-io/go-nats"
)
@snobu
snobu / force-repull.sh
Last active July 21, 2019 04:09
kubectl set deployment force image repull
#!/bin/bash
# See https://github.com/kubernetes/kubernetes/issues/33664
if [[ $# -eq 0 ]]; then
printf 'Pass deployment name as argument.\n\n'
kubectl get deployment
exit 1
fi
@snobu
snobu / get_azuresql_sessions.sql
Last active October 11, 2018 11:13
Get Azure SQL active sessions
DECLARE @Table TABLE(
SPID INT,
Status VARCHAR(MAX),
LOGIN VARCHAR(MAX),
HostName VARCHAR(MAX),
BlkBy VARCHAR(MAX),
DBName VARCHAR(MAX),
Command VARCHAR(MAX),
CPUTime INT,
DiskIO INT,
@snobu
snobu / .profile
Last active September 25, 2018 15:50
openssl s_client wrapper
# Call as:
# $ sc google.com
function sc {
openssl s_client -connect $1:443 -servername $1 "${@:2}"
}
@snobu
snobu / armclient.json
Last active September 13, 2018 08:00
ARMClient scoop bucket
{
"version": "1.3",
"license": "Apache",
"architecture": {
"32bit": {
"url": "https://github.com/projectkudu/ARMClient/releases/download/v1.3/ARMClient.zip",
"hash": "029e54777c863b1b27fc9caf201d0279b1b76f3ba3da882c367f6ec730539b8d"
},
"64bit": {
"url": "https://github.com/projectkudu/ARMClient/releases/download/v1.3/ARMClient.zip",
# apt-get install
sudo apt-get update
# For ubuntu 14.04
sudo apt-get install -y xserver-xorg-video-dummy-lts-trusty
# For ubuntu 16.04
sudo apt-get install -y xserver-xorg-video-dummy-lts-willy
# Copy the xorg.conf to `/etc/X11/xorg.conf`.
wget -P /etc/X11 https://gist.githubusercontent.com/mangoliou/ba126832f2fb8f86cc5b956355346038/raw/b6ad063711226fdd6413189ad905943750d64fd8/xorg.conf
@snobu
snobu / gist:f2acf3a3d96cc45f96adbdc18e691f9d
Created September 11, 2018 10:31
Match private key with public cert
~ $ openssl pkey -in key.pem -pubout -outform pem | openssl md5
(stdin)= 5bxxxxxxxxxxxxxxxxxxx5f9
~ $ openssl x509 -in public-cert.pem -pubkey -noout -outform pem | openssl md5
(stdin)= 5bxxxxxxxxxxxxxxxxxxx5f9
@snobu
snobu / gist:200b31f148e16fa0fe80e9fee5b9742c
Created August 27, 2018 22:20
Azure Media Services v2 API call with curl
curl -Ss https://amsd.restv2.westeurope.media.azure.net/api/Channels -H "Authorization: Bearer $BEARER" -H "x-ms-version: 2.19" -H "Accept: application/json" | jq
@snobu
snobu / user.settings.json
Created August 11, 2018 09:39
Disable open editors section in VSCode sidebar
"explorer.openEditors.visible": 0