Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
o(≧▽≦)o

Stanislas angristan

:shipit:
o(≧▽≦)o
View GitHub Profile
@angristan
angristan / fixpngdate.py
Created Sep 19, 2020
Fix PNG file date from file name
View fixpngdate.py
import datetime
import os
import re
import sys
import time
import piexif
def fix(directory):
View I'm a night 🦉
🌞 Morning 170 commits ██▋░░░░░░░░░░░░░░░░░░ 13.0%
🌆 Daytime 456 commits ███████▎░░░░░░░░░░░░░ 34.8%
🌃 Evening 454 commits ███████▎░░░░░░░░░░░░░ 34.7%
🌙 Night 230 commits ███▋░░░░░░░░░░░░░░░░░ 17.6%
View tp.py
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 Feb 12, 2020
Install Arch Linux
View install-arch.sh
# 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%
View rpi_temp.json
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"gridPos": {
"h": 9,
"w": 12,
View rpi_cpu_freq.json
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"gridPos": {
"h": 9,
"w": 12,
@angristan
angristan / single-node-es.md
Last active Apr 6, 2020
Elasticsearch settings for single-node cluster (1 shard, 0 replica)
View single-node-es.md

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 Feb 16, 2019
Mastodon DB migration
View psql_migration.md

Migrating the Mastodon database

On the old server

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

OR

@angristan
angristan / rankmirrors.sh
Created Feb 13, 2019
Get fast pacman mirrors on Arch
View rankmirrors.sh
#!/bin/bash
country=FR
cd /tmp
wget "https://www.archlinux.org/mirrorlist/?country=${country}&protocol=http&protocol=https&ip_version=4&ip_version=6" -O mirrorlist.tmp
sed -i 's/^#Server/Server/' mirrorlist.tmp
rankmirrors mirrorlist.tmp > mirrorlist
sudo cp mirrorlist /etc/pacman.d/mirrorlist
@angristan
angristan / test.sh
Created Feb 9, 2019
Lint shell executables with shellcheck
View test.sh
#!/bin/bash
set -e
set -o pipefail
ERRORS=()
# find all executables and run `shellcheck`
for f in $(find . -type f -not -iwholename '*.git*' | sort -u); do
if file "$f" | grep --quiet shell; then
{
You can’t perform that action at this time.