Skip to content

Instantly share code, notes, and snippets.

@adnaan
adnaan / script.sh
Last active September 25, 2019 13:02
Parse and execute a simple bash script.
ls -la
echo "hello"
tree
adb devices
adb wait-for-device #example of a long running task
@olov
olov / gist:eb60ab878eb73a7c5e22
Created October 15, 2014 08:55
listenandservetls_nossl30.go
// You don't want to serve HTTPS supporting for SSL3.0 any longer, see:
// http://googleonlinesecurity.blogspot.de/2014/10/this-poodle-bites-exploiting-ssl-30.html
import (
"crypto/tls"
"net/http"
)
// This code supports SSL3.0, TLS1.0, TLS1.1 and TLS1.2
// Chances are you currently do this but want to stop due to the POODLE
err := http.ListenAndServeTLS(addr, "crtfile", "keyfile", handler)
@andreagrandi
andreagrandi / insert_element_list.go
Last active August 29, 2015 14:05
How to insert an element at position i in an arrray of strings
package main
import (
"fmt"
)
func main() {
list_a := []string{"apple", "orange", "grapes"}
fmt.Println(list_a)
i := 1
@rubencaro
rubencaro / install_elixir.md
Last active September 30, 2023 03:58
Elixir installation guide

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir and you are good to go.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then asdf is your best friend.

@intarstudents
intarstudents / README.md
Created December 18, 2013 08:40
Upgrade debian to testing

Stolen from here:

sudo cp /etc/apt/sources.list{,.bak}
sudo sed -i -e 's/ \(stable\|wheezy\)/ testing/ig' /etc/apt/sources.list
sudo apt-get update
sudo apt-get --download-only dist-upgrade
sudo apt-get dist-upgrade
@nicolashery
nicolashery / elasticsearch.md
Last active December 30, 2023 19:03
Elasticsearch: updating the mappings and settings of an existing index

Elasticsearch: updating the mappings and settings of an existing index

Note: This was written using elasticsearch 0.9.

Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:

$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
  "_id": 1,
@JalfResi
JalfResi / revprox.go
Last active May 7, 2025 07:35
Simple reverse proxy in Go
package main
import(
"log"
"net/url"
"net/http"
"net/http/httputil"
)
func main() {
@crosbymichael
crosbymichael / Dockerfile
Last active January 8, 2022 13:47
Docker with supervisor
FROM ubuntu
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install -y openssh-server supervisor
ADD sshd.conf /etc/supervisor/conf.d/sshd.conf
RUN mkdir -p /var/run/sshd
@intarstudents
intarstudents / pgadmin-ppa.sh
Created January 21, 2013 10:37
Ubuntu pgAdmin PPA
apt-add-repository ppa:pitti/postgresql
apt-get update && apt-get upgrade
@intarstudents
intarstudents / fix_synapse_apps.sh
Created November 13, 2012 20:58
Linux Mint 13 & 14 (MATE) - Fix missing application shortcuts in Synapse
#!/bin/sh
for file in $(grep -il "^OnlyShowIn=MATE;$" /usr/share/applications/*.desktop); do
echo "patching $file"
sed -e "s/OnlyShowIn=MATE;/#OnlyShowIn=MATE;/ig" $file > /tmp/tempfile.tmp
mv -f /tmp/tempfile.tmp $file
done