Skip to content

Instantly share code, notes, and snippets.

View panta's full-sized avatar

Marco Pantaleoni panta

  • /*jupiter jazz*/
  • Padova
View GitHub Profile
@rogiervandenberg
rogiervandenberg / main.go
Created October 5, 2020 13:13
Basis Golang HTTP REST server - Best practices interpreted
/*
Based on the video's and blogposts of Mat Ryer (@matryer)..
- https://pace.dev/blog/2018/05/09/how-I-write-http-services-after-eight-years.html
- https://www.youtube.com/watch?v=FkPqqakDeRY
- https://www.youtube.com/watch?v=rWBSMsLG8po
.. I derived the following starting point for a GO HTTP REST server. It can be used to add all explained (see above) concepts.
You could spread the code below in separate files as follows:
@peterwwillis
peterwwillis / defaultenv.sh
Created May 29, 2019 14:33
Load environment variables from a file with key=value pairs and optionally execute a program
#!/bin/sh
# defaultenv.sh - Load environment variable defaults and run programs
set -e
[ x"$DEBUG" = "x1" ] && set -x
_load_envrc () {
local file="$1"; shift
if [ -r "$file" ] ; then
# Bourne shell limits how we can test and set env vars, so here I'm
@davewongillies
davewongillies / Terraform_functions.md
Last active October 11, 2024 16:44
Terraform Functions

Supported built-in functions

  • abs(float) - Returns the absolute value of a given float. Example: abs(1) returns 1, and abs(-1) would also return 1, whereas abs(-3.14) would return 3.14. See also the signum function.

  • basename(path) - Returns the last element of a path.

  • base64decode(string) - Given a base64-encoded string, decodes it and returns the original string.

cmake_minimum_required(VERSION 3.7)
project(esp_vt100_firmware)
set(CMAKE_CXX_STANDARD GNU99)
set(SOURCE_FILES
include/uart_hw.h
include/user_config.h
user/io.c
user/io.h
@ben-axnick
ben-axnick / 2015-11-yadm.md
Created January 22, 2016 00:33
How to manage dotfiles with YADM

Background

Solutions I've tried

  • Git repo directly checked out in home directory

    • Noisy
    • Have to ignore *, everything is a --force
    • Juggling machine variations is a pain
  • Homesick / Homeshick

@0
0 / msp430-elf.md
Last active August 18, 2023 10:36
Building a GCC cross-compiler for the MSP430.

msp430-elf

The following are instructions for building a GCC cross-compiler for the MSP430. They are based in part on Peter Bigot's post to mspgcc-users.

Setup

export PREFIX=/usr/local/msp430
@pmdarrow
pmdarrow / iterm-launcher.js
Last active September 14, 2017 20:52
Launch iTerm 2 with a predefined tab & split configuration using Apple's "Javascript for Automation"
/**
* AppleScript to launch iterm2 terminals/tabs with configurable:
* ~ Name <name>
* ~ List of commands <cmds>
* ~ Split behavior horizontal(h) or vertical(v) <split> :: (h, v)
*
* Run from terminal with `osascript iterm-launcher.js`.
* Don't unfocus with the mouse/keyboard while executing the script.
*
* JS port of https://github.com/luismartingil/scripts/blob/master/iterm_launcher02.applescript
class @BaseCtrl
@register: (app, name) ->
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1]
app.controller name, this
@inject: (annotations...) ->
ANNOTATION_REG = /^(\S+)(\s+as\s+(\w+))?$/
@annotations = _.map annotations, (annotation) ->
@samny
samny / dl-dt-with-multiple-dd-style.css
Last active May 23, 2017 10:19
Best way I found of styling a definition list as name value pairs and allowing either dt or dl to span multiple rows. http://www.css-101.org/articles/glossary-and-table-format/definition-list.php
dl.job-info{
width:100%;
overflow:hidden;
}
dl.job-info dt {
font-weight:600;
float:left;
width:49%;
@spikebike
spikebike / client.go
Created March 29, 2012 01:13
TLS server and client
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)