Skip to content

Instantly share code, notes, and snippets.

View Depado's full-sized avatar
😁
Coding and Writing Posts

Depado

😁
Coding and Writing Posts
View GitHub Profile
@zenazn
zenazn / gist:c5c8528efe1a00634096
Created May 4, 2014 18:07
agrison/golang-mux-benchmark
[master] ~/go/src/github.com/agrison/golang-mux-benchmark$ go test -bench=. 2>/dev/null
PASS
BenchmarkGocraftWeb_Simple 2000000 926 ns/op
BenchmarkGocraftWeb_Route15 1000000 2203 ns/op
BenchmarkGocraftWeb_Route75 1000000 2204 ns/op
BenchmarkGocraftWeb_Route150 1000000 2232 ns/op
BenchmarkGocraftWeb_Route300 1000000 2255 ns/op
BenchmarkGocraftWeb_Route3000 1000000 2481 ns/op
BenchmarkGocraftWeb_Middleware 1000000 1539 ns/op
BenchmarkGocraftWeb_Composite 500000 3518 ns/op

Zoom the Gitter Desktop window

  • On Windows: Gitter -> Developer Tools

Paste this into the console, change the zoomLevel to the desired value.

var desktopWindow = gui.Window.get();
desktopWindow.zoomLevel = 0;
@imagescape
imagescape / UpgradeDjango.md
Last active June 27, 2018 12:16
Upgrade Django from 1.1 to 1.5.1. This highlights some of the issues that one may encounter when updating Django. It's not possible to cover every case, but this should provide a good general starting point.

Upgrade Django from 1.1 to 1.5.1. This highlights some of the issues that one may encounter when updating Django. It's not possible to cover every case, but this should provide a good general starting point.

Change to DATABASES variable in settings.py.

Django now supports multiple databases and changes are needed to how the database connections are defined.

  • Changed in Django 1.2
  • Change Required by Django 1.4
  • Source:
@JamesMessinger
JamesMessinger / NewsArticle.yaml
Last active July 31, 2018 09:13
Example of using `allOf` to extend an object in a Swagger API
swagger: "2.0"
info:
version: "1.0.0"
title: minimal
description: News Articles ftw
paths:
/users:
get:
responses:
"200":
// Processing code by Etienne JACOB
// motion blur template by beesandbombs
// result of this is more like tumblr version than twitter version (https://necessary-disorder.tumblr.com/image/190425356073)
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
@morph027
morph027 / Caddyfile
Created May 17, 2020 19:16
caddy2 ip filter
intranet.example.com {
@ipfilter {
not remote_ip 192.168.0.0/16
}
route @ipfilter {
# redirect
redir https://example.com/
# or respond
# respond "Access denied" 403 {
# close
@gonzaloserrano
gonzaloserrano / log.go
Created August 18, 2015 17:56
logrus wrapper
package log
import (
"fmt"
"github.com/Sirupsen/logrus"
"runtime"
"strings"
)
var logger = logrus.New()
@freeformz
freeformz / WhyILikeGo.md
Last active October 6, 2022 23:31
Why I Like Go

A slightly updated version of this doc is here on my website.

Why I Like Go

I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.

Goroutines

The first 1/2 of Go's concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as go f(x), where f() is a function.

@gene1wood
gene1wood / example_aws_lambda_cloudformation_context.md
Last active January 4, 2023 06:41
Details on the AWS Lambda Python LambdaContext context object when instantiated from a CloudFormation stack

LambdaContext

Here is the raw output from examining the Python LambdaContext context object in a AWS Lambda function when called from a CloudFormation stack. More information on the context object can be found here : http://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html

LambdaContext object : print(context)

<__main__.LambdaContext object at 0x7fd706780710>

LambdaContext vars : vars(context)

@estahn
estahn / metabase.service
Last active January 30, 2023 14:25
Systemd file for Metabase
[Unit]
Description=Metabase server
After=syslog.target
After=network.target
[Service]
WorkingDirectory=/home/data/tools/metabase
ExecStart=/usr/bin/java -jar /home/data/tools/metabase/metabase.jar
Environment=MB_JETTY_PORT=8080
User=data