Skip to content

Instantly share code, notes, and snippets.

View MilosSimic's full-sized avatar

Milos MilosSimic

  • Faculty of technical sciences Novi Sad
  • Novi Sad
View GitHub Profile

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
@hongster
hongster / tcp_timeout.go
Created October 2, 2015 11:30
Golang example on handling TCP connection and setting timeout.
package main
import (
"fmt"
"net"
"time"
"bufio"
)
func handleConnection(conn net.Conn) {
@6174
6174 / golang-tls.md
Created December 12, 2016 06:33 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
@F21
F21 / raft.go
Created November 15, 2017 05:05
Sample hashicorp/raft + hashicorp/serf app
package main
import (
"crypto/md5"
"flag"
"fmt"
"io"
"log"
"os"
"path/filepath"
@brandt
brandt / bloom-filter-calculator.rb
Created February 17, 2015 17:19
Calculate the required bloom filter size and optimal number of hashes from the expected number of items in the collection and acceptable false-positive rate
# Optimal bloom filter size and number of hashes
# Tips:
# 1. One byte per item in the input set gives about a 2% false positive rate.
# 2. The optimal number of hash functions is ~0.7x the number of bits per item.
# 3. The number of hashes dominates performance.
# Expected number of items in the collection
# n = (m * ln(2))/k;
n = 300_000
@k3yavi
k3yavi / spacemacs-cheatsheet.txt
Last active February 28, 2024 01:15 — forked from davoclavo/spacemacs-cheatsheet.md
Spacemacs cheatsheet
//from http://www.saltycrane.com/blog/2015/12/switching-emacs-vim-actually-spacemacs/
Useful Spacemacs commands
SPC q q - quit
SPC w / - split window vertically
SPC w - - split window horizontally
SPC 1 - switch to window 1
SPC 2 - switch to window 2
SPC w c - delete current window
@pcgeek86
pcgeek86 / install_go_pi.sh
Last active February 24, 2024 19:35 — forked from random-robbie/install_go_pi.sh
Install Go Lang on Raspberry Pi
cd $HOME
FileName='go1.13.4.linux-armv6l.tar.gz'
wget https://dl.google.com/go/$FileName
sudo tar -C /usr/local -xvf $FileName
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrc
@robphoenix
robphoenix / spacemacs-cheshe.md
Last active February 6, 2024 23:11
[DEPRECATED] Spacemacs Cheat Sheet - Visit https://github.com/Ben-PH/spacemacs-cheatsheet

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
@kenshinx
kenshinx / client.go
Last active February 3, 2024 18:49
golang socket server & client ping-pong demo
package main
import (
"os"
"log"
"net"
"strconv"
"strings"
)
@superbrothers
superbrothers / main.go
Created September 8, 2016 02:42
http request with context in Go
package main
import (
"context"
"fmt"
"log"
"net/http"
"time"
)