Skip to content

Instantly share code, notes, and snippets.

:shipit:
o(≧▽≦)o

Stanislas angristan

:shipit:
o(≧▽≦)o
Block or report user

Report or block angristan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 Feb 19, 2019
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
{
@angristan
angristan / rename.rb
Created Dec 1, 2018
Ruby script ro rename all of a dir's files with random names
View rename.rb
directory = 'directory/'
new_base_filename_length = 10
Dir.glob(directory + '*').sort.each do |old_filename|
new_base_filename = ('a'..'z').to_a.shuffle[0, new_base_filename_length].join
new_filename = directory + new_base_filename + File.extname(old_filename)
File.rename(old_filename, new_filename)
end
View gitconfig
[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
@angristan
angristan / borgmatic.yml
Created Jul 29, 2018
borgmatic example
View borgmatic.yml
location:
source_directories:
- /backup/lyra/files/rsync
one_file_system: true
repositories:
- /backup/lyra/files/borg
storage:
compression: zstd
umask: 0077
View prompt.js
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const ask = () => {
rl.question('> ', res => {
console.log(res);
ask();
You can’t perform that action at this time.