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 / 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 / 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):
🌞 Morning 123 commits █▉░░░░░░░░░░░░░░░░░░░ 9.4%
🌆 Daytime 345 commits █████▌░░░░░░░░░░░░░░░ 26.3%
🌃 Evening 548 commits ████████▊░░░░░░░░░░░░ 41.8%
🌙 Night 295 commits ████▋░░░░░░░░░░░░░░░░ 22.5%
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', )
@angristan
angristan / install-arch.sh
Last active February 12, 2020 17:51
Install Arch Linux
# Prepare env
timedatectl set-ntp true
timedatectl set-timezone Europe/Paris
# Partition disk
parted /dev/sda mklabel gpt
parted -a optimal /dev/sda mkpart primary fat32 0% 512MB
parted /dev/sda set 1 esp on
parted -a optimal /dev/sda mkpart primary linux-swap 512MB 2560MB
parted -a optimal /dev/sda mkpart primary ext4 2560MB 100%
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"gridPos": {
"h": 9,
"w": 12,
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"gridPos": {
"h": 9,
"w": 12,
@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 / psql_migration.md
Last active February 16, 2019 21:57
Mastodon DB migration

Migrating the Mastodon database

On the old server

postgres@postgresql:~$ pg_dump -Fc mastodon -f mastodon.dump

OR