Skip to content

Instantly share code, notes, and snippets.

View micheleriva's full-sized avatar
🍄
Building Orama

Michele Riva micheleriva

🍄
Building Orama
View GitHub Profile
@hiyosi
hiyosi / gist:3850864
Created October 8, 2012 05:27
Yaws REST API sample
-module(rest).
-include("/opt/local/lib/erlang/lib/stdlib-1.18.2/include/qlc.hrl").
-include("/opt/local/lib/yaws/include/yaws_api.hrl").
-export([out/1, addAirport/4, handle/2 ]).
-define(RECORD_TYPE, airport).
-define(RECORD_KEY_FIELD, code).
@pauloricardomg
pauloricardomg / cors.nginxconf
Last active March 8, 2024 18:31
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active July 2, 2024 00:02
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@andrewmilson
andrewmilson / file-upload-multipart.go
Last active June 29, 2024 14:07
Golang multipart/form-data File Upload
package main
import (
"net/http"
"os"
"bytes"
"path"
"path/filepath"
"mime/multipart"
"io"
@jaawerth
jaawerth / compose.es6.js
Last active October 17, 2020 08:08
ES5 and ES6 implementations of compose - readable implementation, not optimized
function compose(...fnArgs) {
const [first, ...funcs] = fnArgs.reverse();
return function(...args) {
return funcs.reduce((res, fn) => fn(res), first(...args));
};
}
@diegopacheco
diegopacheco / elasticsearch-es-delete-all-data.md
Created August 10, 2016 21:36
How to Delete All Data in Elasticsearch?
curl -XDELETE localhost:9200/*
@j-min
j-min / test_multi_gpu.py
Last active January 15, 2022 01:57
TensorFlow multi GPU example
from __future__ import print_function
'''
Basic Multi GPU computation example using TensorFlow library.
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
'''
This tutorial requires your machine to have 2 GPUs
"/cpu:0": The CPU of your machine.
@apisandipas
apisandipas / share-urls.md
Last active July 5, 2024 05:25 — forked from chrisjlee/drupal-views-share-global-text-field
Share url's for Facebook, Twitter, Pinterest and Linkedin with just get variables

Creating share buttons with just URL's

Twitter

http://twitter.com/share?text=<TITLE>&url=<URL>

E.g. http://twitter.com/share?text=This+is+google+a+search+engine&url=https%3A%2F%2Fwww.google.com

Facebook

http://www.facebook.com/sharer.php?u=&amp;p[title]=

@ydnar
ydnar / redirects.js
Last active September 12, 2023 10:14
Nuxt.js middleware to enable redirects to absolute URLs
import url from 'url'
import qs from 'qs'
export default function (ctx) {
fixRedirect(ctx)
const { route, redirect } = ctx
const { path, query } = route
// Redirect trailing slashes, preserving query string: /foo/ -> /foo
if (path.length > 1 && path.slice(-1) === '/') {
@Bonno
Bonno / README.md
Last active August 11, 2023 14:13
Opening multiple SSH sessions with iTerm automatically. To be used in an Automator flow.

Create a new Automater flow

Add 'Service'. Service receives 'no input' in 'iTerm'. Add 'Run AppleScript'.