Skip to content

Instantly share code, notes, and snippets.

Avatar
😻
Happy

Steffen Uhlig suhlig

😻
Happy
  • IBM
  • Cloud
View GitHub Profile
View _my_golang_script.go
//usr/bin/env true; go run `dirname $0`/*.go "$@"; exit $?
package main
import (
"errors"
"os"
)
// TODO: catch Panics and emit a clear message
func main() { os.Exit(mainWithExitCode()) }
@suhlig
suhlig / install-tmux
Last active Dec 23, 2020 — forked from philipsd6/install-tmux
Install tmux on rhel/centos
View install-tmux
# Install tmux on rhel/centos 7
# What do we want?
libeventversion=2.1.11
tmuxversion=3.1
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
@posener
posener / go-shebang-story.md
Last active Jan 20, 2021
Story: Writing Scripts with Go
View go-shebang-story.md

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@maruel
maruel / Instructions
Created Jan 2, 2017
systemd files to enable SPI on startup on a C.H.I.P.
View Instructions
- Create the two files enable_spi.service and enable_spi.timer in /etc/systemd/system/
- Run the following:
sudo systemctl daemon-reload
sudo systemctl enable enable_spi.timer
sudo systemctl start enable_spi
/dev/spidev32766.0 should now be visible.
@colthreepv
colthreepv / Dockerfile
Last active Feb 6, 2020
Concourse CI inside Docker compose v2
View Dockerfile
FROM alpine:latest
RUN apk update && apk upgrade && \
apk add --no-cache \
openssh
RUN mkdir -p /keys/web /keys/worker
CMD ssh-keygen -t rsa -f /keys/web/tsa_host_key -N '' && \
ssh-keygen -t rsa -f /keys/web/session_signing_key -N '' && \
@schmohlio
schmohlio / sse.go
Last active Jan 13, 2021 — forked from ismasan/sse.go
Example SSE server in Golang
View sse.go
// v2 of the great example of SSE in go by @ismasan.
// includes fixes:
// * infinite loop ending in panic
// * closing a client twice
// * potentially blocked listen() from closing a connection during multiplex step.
package main
import (
"fmt"
"log"
@soxofaan
soxofaan / README.md
Last active Dec 10, 2020
Simple pretty CSV and TSV file viewer.
View README.md
@foxel
foxel / !haproxy+docker-gen.md
Last active Jan 23, 2019
Haproxy + docker-gen hostname routing
View !haproxy+docker-gen.md

What is this?

This gist includes config for haproxy + docker-gen system with routing http requests to different containers based on hostname label.

pre requirements

@igrr
igrr / ESP8266httpsUpdate.ino
Last active Dec 15, 2020
ESP8266 ota over HTTPS
View ESP8266httpsUpdate.ino
/*
OTA update over HTTPS
As an example, we download and install ESP8266Basic firmware from github.
Requires latest git version of the core (November 17, 2015)
Created by Ivan Grokhotkov, 2015.
This example is in public domain.
*/
@havenwood
havenwood / brew-ruby-chruby.sh
Last active Feb 3, 2020
Install the latest Homebrew precompiled Ruby with the chruby Ruby version switcher.
View brew-ruby-chruby.sh
# Install Homebrew if you haven't already:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install the latest stable Ruby and chruby:
brew install ruby chruby
# Symlink brew Ruby to ~/.rubies where chruby will autodetect it:
mkdir -p "$HOME/.rubies"
ln -s "$(brew --prefix ruby)" "$HOME/.rubies/ruby-$(brew ls --versions ruby | cut -d" " -f2)"