Skip to content

Instantly share code, notes, and snippets.

@irq0
irq0 / .clang-format
Last active March 14, 2023 15:48
ceph clang-format
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
@irq0
irq0 / dirtree_bench.py
Created July 27, 2022 11:54
Benchmark random id -> directory tree mappings
#!/usr/bin/env python3
# Benchmark random id -> directory tree mappings
import uuid
import pathlib
import re
import random
import click
import multiprocessing
import time
#!/usr/bin/env python
import requests
import sys
req = requests.get("https://www.eventphone.de/guru2/phonebook?event=Chaos+Communication+Camp+2015&s={}&installedonly=0&format=json".format(sys.argv[1]), verify=False)
if req.ok:
print req.json()[0]["name"]
@irq0
irq0 / logstash.conf
Created October 28, 2014 11:25
logstash config - extract data from ceph logs
input {
gelf {
port => 12222
type => gelf
codec => json { }
}
}
filter {
if [type] == "gelf" {
@irq0
irq0 / attach_image.py
Last active August 29, 2015 14:05
rss2email post-processor: Attach images
import re
import requests
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
URL_REGEX = re.compile(r"""((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.‌​][a-z]{2,4}/)(?:[^\s()<>]+|(([^\s()<>]+|(([^\s()<>]+)))*))+(?:(([^\s()<>]+|(‌​([^\s()<>]+)))*)|[^\s`!()[]{};:'".,<>?«»“”‘’]))""", re.DOTALL)
def fetch_img(url):
result = None
@irq0
irq0 / gist:c176fbdd0c3889c16093
Created July 31, 2014 15:16
.lein/profiles.clj
{:user {:plugins [[lein-ancient "0.5.5"]
[lein-ritz "0.7.0"]]
:repl-options {:nrepl-middleware [io.aviso.nrepl/pretty-middleware
cider.nrepl.middleware.inspect/wrap-inspect
cider.nrepl.middleware.classpath/wrap-classpath
cider.nrepl.middleware.complete/wrap-complete
cider.nrepl.middleware.info/wrap-info
cider.nrepl.middleware.inspect/wrap-inspect
cider.nrepl.middleware.macroexpand/wrap-macroexpand
*.xml diff=xml
*.png diff=exif
*.xml2 diff=xml
#!/bin/bash
URL="http://doxieflashair.local"
DIRS="/DCIM/100DOXIE"
list () {
curl -s "${URL}/command.cgi?op=100&DIR=${1}" \
| awk 'BEGIN { FS=","; OFS="/" } /.+,(.+,){3}/ { print $1,$2 }'
}
{:user {:plugins [[lein-ancient "0.5.4"]
[lein-ritz "0.7.0"]]
:repl-options {:nrepl-middleware [io.aviso.nrepl/pretty-middleware
inspector.middleware/wrap-inspect
ritz.nrepl.middleware.javadoc/wrap-javadoc
ritz.nrepl.middleware.apropos/wrap-apropos]}
:dependencies [[spyscope "0.1.4"]
[org.clojure/tools.namespace "0.2.4"]
@irq0
irq0 / fireplace
Created December 11, 2013 00:51
Play a nice fireplace video on XBMC
#!/bin/bash
xbmc_play_url $(youtube-dl -g $(youtube_search.py fireplace hd | sort -R | cut -f1 -d " " | head -1))