Skip to content

Instantly share code, notes, and snippets.

View angristan's full-sized avatar
:shipit:
o(≧▽≦)o

Stanislas angristan

:shipit:
o(≧▽≦)o
View GitHub Profile
@angristan
angristan / single-node-es.md
Last active February 4, 2024 19:55
Elasticsearch settings for single-node cluster (1 shard, 0 replica)

Elasticsearch settings for single-node cluster

1 shard, 0 replica.

For future indices

Update default template:

curl -X PUT http://localhost:9200/_template/default -H 'Content-Type: application/json' -d '{"index_patterns": ["*"],"order": -1,"settings": {"number_of_shards": "1","number_of_replicas": "0"}}' 
@angristan
angristan / main.go
Created December 16, 2023 16:07
Go slices
package main
import (
"fmt"
"reflect"
"unsafe"
)
func main() {
s := make([]string, 1, 2)
@angristan
angristan / install_docker.sh
Last active October 11, 2023 14:52
Script to install Docker and Docker-Compose on Debian
#!/bin/bash
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common sudo
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"
apt-get update
@angristan
angristan / gitconfig
Created October 16, 2018 21:05
git plog
[alias]
plog = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
🌞 Morning 123 commits █▉░░░░░░░░░░░░░░░░░░░ 9.4%
🌆 Daytime 345 commits █████▌░░░░░░░░░░░░░░░ 26.3%
🌃 Evening 548 commits ████████▊░░░░░░░░░░░░ 41.8%
🌙 Night 295 commits ████▋░░░░░░░░░░░░░░░░ 22.5%
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"gridPos": {
"h": 9,
"w": 12,
@angristan
angristan / FileCalculatorKata.go
Last active January 18, 2021 15:50
Dirty calculator
package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
)
@angristan
angristan / fixpngdate.py
Created September 19, 2020 11:43
Fix PNG file date from file name
import datetime
import os
import re
import sys
import time
import piexif
def fix(directory):
@angristan
angristan / hosts
Last active May 31, 2020 15:00
Windows 10 Privacy Hosts file
0.0.0.0 choice.microsoft.com
0.0.0.0 choice.microsoft.com.nsatc.net
0.0.0.0 df.telemetry.microsoft.com
0.0.0.0 diagnostics.support.microsoft.com
0.0.0.0 feedback.microsoft-hohm.com
0.0.0.0 feedback.search.microsoft.com
0.0.0.0 feedback.windows.com
0.0.0.0 oca.telemetry.microsoft.com
0.0.0.0 oca.telemetry.microsoft.com.nsatc.net
0.0.0.0 onesettings-bn2.metron.live.com.nsatc.net
import ply.yacc as yacc
import ply.lex as lex
from genereTreeGraphviz2 import printTreeGraph
tokens = (
'NUMBER', 'MINUS',
'PLUS', 'TIMES', 'DIVIDE',
'LPAREN', 'RPAREN', 'PRINT',
'EQUALS', 'NAME', 'IF', 'SEMICOLON',
'GTH', 'LTH', 'GTHOREQUAL', 'LTHOREQUAL', 'EQUALEQUAL', 'NOTEQUAL', )