Skip to content

Instantly share code, notes, and snippets.

View stevenferrer's full-sized avatar
💭
I may be slow to respond.

Steven Ferrer stevenferrer

💭
I may be slow to respond.
View GitHub Profile
@Hunsin
Hunsin / router.go
Last active October 4, 2024 02:51
The package wraps julienschmidt's httprouter, making it support functions such as middlewares, sub/group routing with same prefix. Written in Go (Golang).
package router
import (
"context"
"net/http"
gpath "path"
"github.com/julienschmidt/httprouter"
)
@reagent
reagent / 00_README.md
Last active January 31, 2025 08:46
Custom HTTP Routing in Go

Custom HTTP Routing in Go

Basic Routing

Responding to requests via simple route matching is built in to Go's net/http standard library package. Just register the path prefixes and callbacks you want invoked and then call the ListenAndServe to have the default request handler invoked on each request. For example:

package main

import (
/* Scrollbar */
/* From Quassel Wiki: http://sprunge.us/iZGB */
QScrollBar {
background: #131313;
margin: 0;
}
QScrollBar:hover {
/* Optional: Subtle accent of scrolling area on hover */
background: #161616; /* base +2 */
}
@nicolasdao
nicolasdao / open_source_licenses.md
Last active April 29, 2025 00:59
What you need to know to choose an open source license.
@drmalex07
drmalex07 / test1-link-dynamic.cpp
Last active February 5, 2023 08:02
An example unit test with Boost.Test. #boost #c++ #unit-test
@lummie
lummie / enum.go
Last active March 24, 2025 01:09
Golang Enum pattern that can be serialized to json
package enum_example
import (
"bytes"
"encoding/json"
)
// TaskState represents the state of task, moving through Created, Running then Finished or Errorred
type TaskState int
@rms1000watt
rms1000watt / golang-template-if-and.go
Last active July 13, 2023 20:10
Golang script for using templates with IF and AND
package main
import (
"fmt"
"os"
"text/template"
)
type Person struct {
Name string

golang.org rate limiter:

	rl := rate.NewLimiter(1000000, 1)
 
	last := time.Now()
	for i := 0; i < 10; i++ {
		rl.Wait(context.Background())
		cur := time.Now()
		fmt.Println("last", cur.Sub(last))
 last = cur
@IgnoredAmbience
IgnoredAmbience / 99-noto-mono-color-emoji.conf
Last active October 25, 2024 06:01
Noto Emoji Color fontconfig for Konsole
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
Noto Mono + Color Emoji Font Configuration.
Currently the only Terminal Emulator I'm aware that supports colour fonts is Konsole.
Usage:
0. Ensure that the Noto fonts are installed on your machine.
1. Install this file to ~/.config/fontconfig/conf.d/99-noto-mono-color-emoji.conf
@ThomasG77
ThomasG77 / five-minutes-pgadmin4-desktop-install-guide.md
Last active October 14, 2024 11:59
5 minutes PgAdmin4 Desktop install guide

5 minutes PgAdmin4 Desktop install guide

Done on Linux (Ubuntu tested)

Virtualenv & install of Python package & its deps

cd $HOME
virtualenv --python=/usr/bin/python2.7 pgadmin4
source pgadmin4/bin/activate