Skip to content

Instantly share code, notes, and snippets.

@jasoares
jasoares / better_mongos.js
Last active December 18, 2017 02:16
MongoDB Shell mongos helpers and custom prompt
/**
* MongoDB Shell mongos helper functions and custom prompt
*
* https://gist.github.com/jasoares/3b21af33a7d62263010f
*/
sh.getBalancerSummary = function(since) {
// 24 hours by default
since = since || new Date(ISODate().getTime() - 1000 * 60 * 60 * 24);
print("Printing Summary since " + since);
@alpham
alpham / docker-compose.yaml
Created October 28, 2017 12:15
docker compose file to run odoo 11
version: "3"
services:
db:
image: postgres:9.4
deploy:
replicas: 1
volumes:
- pgsql_data:/var/lib/postgresql/data:rw,Z
environment:
@hernamesbarbara
hernamesbarbara / numpy-opttheta.mat
Last active March 18, 2019 16:57
How to import structured matlab data into python with scipy | prototype | http://bit.ly/1cdqxQc
@fabrizioc1
fabrizioc1 / http-proxy.go
Last active October 27, 2020 12:32
Http proxy server in Go
package main
import (
"fmt"
"io"
"log"
"net/http"
)
type HttpConnection struct {
@montanaflynn
montanaflynn / proxy.go
Last active January 17, 2021 15:37
Golang reverse proxy
package main
import (
"log"
"net/http"
"net/http/httputil"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
@thomasdarimont
thomasdarimont / keycloak.html
Created May 17, 2016 07:00
Keycloak JS Only public client example
<html>
<head>
<script src="http://localhost:8081/auth/js/keycloak.js" type="text/javascript">
</script>
</head>
<body>
<h1>js-demo-app</h1>
@veelenga
veelenga / flatten.exs
Last active November 2, 2021 19:02
Flattening array in elixir
def flatten(list), do: flatten(list, []) |> Enum.reverse
def flatten([h | t], acc) when h == [], do: flatten(t, acc)
def flatten([h | t], acc) when is_list(h), do: flatten(t, flatten(h, acc))
def flatten([h | t], acc), do: flatten(t, [h | acc])
def flatten([], acc), do: acc
@mdwhatcott
mdwhatcott / custom_json.go
Created July 29, 2015 17:15
Example of implementing MarshalJSON and UnmarshalJSON to serialize and deserialize custom types to JSON in Go. Playground: http://play.golang.org/p/7nk5ZEbVLw
package main
import (
"bytes"
"encoding/json"
"fmt"
"strconv"
)
func main() {
@robsontenorio
robsontenorio / auth-refresh-token.js
Last active February 3, 2023 14:02
[OAUTH2][KEYCLOAK] Auto refresh token for @nuxtjs/auth module
const strategy = 'keycloak'
export default function ({ app }) {
const { $axios, $auth } = app
if (!$auth.loggedIn || !$auth.strategies[strategy])
return
const options = $auth.strategies.keycloak.options
@drmalex07
drmalex07 / test1-link-dynamic.cpp
Last active February 5, 2023 08:02
An example unit test with Boost.Test. #boost #c++ #unit-test