Skip to content

Instantly share code, notes, and snippets.

@victor-perez
victor-perez / git.bat
Last active August 4, 2021 14:16
Use WSL git inside VS Code from Windows 10 17046
@echo off
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
::this also support calls that contains a absolute windows path
::check of one of the params contain a absolute windows path
echo.%* | findstr /r /c:"[a-z]:[\\/]" > nul
if %errorlevel% == 1 (
::if not just git with the given parameters
call :git %*
@cuixin
cuixin / json_to_map.go
Created October 25, 2017 01:53
json to map[string]interface{} example in golang
package main
import (
"encoding/json"
"fmt"
)
func dumpMap(space string, m map[string]interface{}) {
for k, v := range m {
if mv, ok := v.(map[string]interface{}); ok {
@laurivosandi
laurivosandi / esp32-oled-demo.py
Last active February 8, 2022 03:22
OLED screen demo on ESP32 with MicroPython
# Pull the SDD1306 lib from here https://github.com/adafruit/micropython-adafruit-ssd1306/blob/master/ssd1306.py
from time import sleep_ms
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
buf = "wubba lubba dub dub "
i2c = I2C(-1, Pin(4),Pin(5),freq=40000) # Bitbanged I2C bus
assert 60 in i2c.scan(), "No OLED display detected!"
@jpillora
jpillora / s3get.sh
Last active August 23, 2023 12:07
S3 signed GET in plain bash (Requires openssl and curl)
#!/bin/bash
#set these in your environment/profile (NOT HERE)
AWS_ACCESS_KEY=""
AWS_SECRET_KEY=""
function s3get {
#helper functions
function fail { echo "$1" > /dev/stderr; exit 1; }
#dependency check
@htp
htp / curl-websocket.sh
Last active May 7, 2024 17:08
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@SiegfriedEhret
SiegfriedEhret / pull.go
Created May 9, 2016 04:53 — forked from sithembiso/pull.go
git pull using git2go
func (repo *Repo) Pull() error {
branch, err := repo.Branch()
if err != nil {
return err
}
// Get the name
name, err := branch.Name()
if err != nil {
return err
@molivier
molivier / gist:271bba5d67de1583a8e3
Last active January 3, 2024 09:57
Set $GOPATH on Mac OSX : bash_profile
# Edit ~/.bash_profile
export GOPATH=/Users/$USER/go
export PATH=$GOPATH/bin:$PATH
# Reload profile : source ~/.bash_profile
@yashpatil
yashpatil / JolokiaCommands.md
Last active January 6, 2023 14:59
Jolokia URLs for quick access to A-MQ statistics

This is a quick reference to get to Jolokia statistics urls for JBoss Fuse or JBoss A-MQ statistics. Sometimes, when you are interested in very specific attributes, it's easier to keep monitoring a specific url rather than loading the full Hawtio console.

@benschw
benschw / consul-bootstrap.sh
Created June 26, 2015 16:34
script to bootstrap a single node consul service (e.g. for vagrant)
#!/bin/bash
if [ ! -f /tmp/provisioned ]; then
apt-get update
apt-get install -y daemon wget unzip
touch /tmp/provisioned
fi
@cuibonobo
cuibonobo / Large-app-how-to.md
Last active March 6, 2024 18:40
How to structure a large application in Flask. Taken from the Flask wiki: https://github.com/mitsuhiko/flask/wiki/Large-app-how-to

Here's an example application that uses the pattern detailed below: https://github.com/tantastik/talent-curator


This document is an attempt to describe the first step of a large project structure with flask and some basic modules:

  • SQLAlchemy
  • WTForms

Please feel free to fix and add your own tips.