Skip to content

Instantly share code, notes, and snippets.

View snobu's full-sized avatar

Adrian Calinescu snobu

View GitHub Profile
@snobu
snobu / team7_notes.txt
Created October 22, 2019 08:11
OpenHack Team #7 notes
####
@snobu
snobu / udp_server.py
Created October 4, 2019 13:35 — forked from majek/udp_server.py
Simple python udp server
import logging
import socket
log = logging.getLogger('udp_server')
def udp_server(host='127.0.0.1', port=1234):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
@snobu
snobu / index.js
Created August 5, 2019 07:37
azure-functions-fulfill-intent-for-alexa
let Client = require('azure-iothub').Client;
let Message = require('azure-iot-common').Message;
let names = require('docker-names');
let IOTHUB_CONNSTR_SERVICE = process.env.IOTHUB_CONNSTR_SERVICE;
let serviceClient = Client.fromConnectionString(IOTHUB_CONNSTR_SERVICE);
module.exports = function(context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
let intent = req.body.request.intent.name;
@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 / app_manifest.json
Created April 28, 2019 16:58
MT3620 with SSD1306 OLED via i2c
{
"SchemaVersion": 1,
"Name" : "SeeedOLED_I2C",
"ComponentId" : "4595840c-94e8-48ea-9bd2-1b8167015973",
"EntryPoint": "/bin/app",
"CmdArgs": [],
"Capabilities": {
"AllowedConnections": [],
"AllowedTcpServerPorts": [],
"AllowedUdpServerPorts": [],
@snobu
snobu / gist:2d3d3b6f1ff2a36663c8dc6be697a647
Created March 14, 2019 13:21
Patch for prometheus-operator with Helm chart
# Error: release prometheus-operator failed: customresourcedefinitions.apiextensions.k8s.io
# "alertmanagers.monitoring.coreos.com" already exists
# https://github.com/coreos/prometheus-operator/issues/2229
kubectl delete crd prometheusrules.monitoring.coreos.com
kubectl delete crd servicemonitors.monitoring.coreos.com
kubectl delete crd alertmanagers.monitoring.coreos.com
@snobu
snobu / gist:141cfb6f9bf9d3c46947325e2a6933af
Created March 13, 2019 08:53
Helm cleanup failed releases
helm ls | grep FAILED | awk '{print $1}' | xargs helm delete --purge --debug
$ openssl s_time -connect amisecure.azurewebsites.net:443 -www / -cipher 'RSA' -new
Collecting connection statistics for 30 seconds
*****************************************************************************************************************************
125 connections in 0.29s; 431.03 connections/user sec, bytes read 366875
125 connections in 31 real seconds, 2935 bytes read per connection
@snobu
snobu / Cargo.toml
Created February 26, 2019 11:46
Rust Iron minimal API
[package]
name = "iron"
version = "0.1.0"
authors = ["snobu <foo@snobu.org>"]
edition = "2018"
[dependencies]
iron = "*"
rustc-serialize = "*"
chrono = "*"
@snobu
snobu / code.fish
Created February 26, 2019 09:44
code.fish
# Launch VS Code with 'code' or 'code <path>' from Fish Shell
function code
set location "$PWD/$argv"
open -n -b "com.microsoft.VSCode" --args $location
end