Skip to content

Instantly share code, notes, and snippets.

extern crate scoped_pool;
use std::{env, process, fs};
use std::io::prelude::*;
use std::fs::File;
use std::path::Path;
use std::error::Error;
use scoped_pool::Pool;
Start: Wed Nov 23 10:34:49 2016
HOST: haruka Loss% Snt Last Avg Best Wrst StDev
1.|-- 192.168.173.1 0.0% 20 0.4 0.3 0.2 0.5 0.0
2.|-- 192.168.171.1 0.0% 20 0.5 0.7 0.5 1.2 0.0
3.|-- 96.120.89.189 20.0% 20 1546. 6449. 121.4 10902 3811.4
4.|-- 162.151.30.65 25.0% 20 1456. 6603. 186.6 10797 3787.1
5.|-- 162.151.78.249 30.0% 20 1365. 7017. 737.5 10697 3388.8
6.|-- 68.86.90.93 90.0% 20 7557. 8040. 7557. 8524. 684.0
7.|-- 68.86.89.230 20.0% 20 1184. 6745. 774.7 10476 3151.8
8.|-- 23.30.206.102 20.0% 20 1158. 6656. 715.6 10364 3125.0
# Collect all down/incomplete PGs and create "inventory" files for playbook_remove_pg.yml per PG (separated by empty lines)
ceph health detail |
grep -P "is (down\+)?incomplete, acting" |
cut -d' ' -f2 |
while read pg
do
ceph pg $pg query |
jq -r '.recovery_state[0].probing_osds[]' |
while read osd
do
[lae@haruka ~]$ mtr -wc 2 !$
mtr -wc 2 starlight.lae.is
Start: Tue Jun 28 20:13:19 2016
HOST: haruka Loss% Snt Last Avg Best Wrst StDev
1.|-- gateway 0.0% 2 0.6 0.4 0.3 0.6 0.0
2.|-- 192.168.171.1 0.0% 2 0.4 0.5 0.4 0.6 0.0
3.|-- 96.120.89.189 0.0% 2 11.3 10.8 10.4 11.3 0.0
4.|-- te-0-1-0-14-sur03.sanjose.ca.sfba.comcast.net 0.0% 2 13.0 11.1 9.2 13.0 2.6
5.|-- hu-0-18-0-5-ar01.santaclara.ca.sfba.comcast.net 0.0% 2 13.8 13.5 13.2 13.8 0.0
6.|-- be-33651-cr01.sunnyvale.ca.ibone.comcast.net 0.0% 2 15.6 15.5 15.4 15.6 0.0
@lae
lae / sif.sh
Last active August 12, 2020 09:35
~]$ sif_login=
~]$ sif_passwd=
~]$ sif_device=
~]$ sif_host=
~]$ sif_hmac=
~]$ sifcall() { [ ! -z "$2" ] && _sif_hash=$(printf "$2" | sha1hmac -K $sif_hmac - | awk '{print $1}'); curl -s -w'\n' -XPOST http://$sif_host/main.php/$1 -H 'Client-Version: ' -H 'API-Model: straightforward' -H "Authorize: consumerKey=lovelive_test&timeStamp=$(date +%s)&version=1.1&nonce=$sif_nonce$([ -z "$sif_token" ] || printf \&token=$sif_token)" -H "User-ID: ${sif_uid:-0}" -H "X-Message-Code: ${_sif_hash:-0}" $([ ! -z "$2" ] && printf -- "-F request_data=")$2; unset _sif_hash; let sif_nonce=$((sif_nonce+1)); }
~]$ siflogin() { _sif_response=$(sifcall login/login '{"login_key":"'$sif_login'","login_passwd":"'$sif_passwd'","devtoken":"'$sif_device'"}'); sif_token=$(printf "$_sif_response" | jq -r '.response_data.authorize_token'); sif_uid=$(printf "$_sif_response" | jq -r '.response_data.user_id'); unset _sif_response; let sif_nonce++; }
~]$ sifstart() { sif_nonce=1; sif_token=$(sifcall login/authkey | jq -r '.response_data.authoriz

Archvsync

This is the central repository for the Debian mirror scripts. The scripts in this repository are written for the purposes of maintaining a Debian archive mirror (and shortly, a Debian bug mirror), but they should be easily generalizable.

Currently the following scripts are available:

@lae
lae / clean_vault
Last active December 10, 2015 23:57 — forked from leucos/clean_vault
Ansible vault transparent encryption revisited
#!/bin/bash
# Just print out the secrets file as-is if the password file doesn't exist
if [ ! -r '.vault_password' ]; then
cat
exit
fi
CONTENT="$(cat)"
# Store vault's stderr in RESULT and redirect encrypted stdout back to stdout
{

Future updates

Dear backers,

I hope this update finds everyone well. I'd like to take this opportunity to apologise for the very infrequent updates and give you a overview of how Project Phoenix is going.

1. Project Phoenix is alive and kicking

Although not exactly the way I wanted to run this project, our project is alive and it is under development.

@lae
lae / minami.py
Created June 22, 2015 06:55
paiza's online hackathon vol 5 (https://paiza.jp/poh/enshura)
# coding: utf-8
# Let's challenge in my favorite language!!
width, height = [int(i) for i in str(input()).split()]
table = [[0 for y in range(height)] for x in range(width)]
for line in range(height):
for i, v in enumerate([int(i) for i in str(input()).split()]):
table[i][line] = v
for col in range(width):