Skip to content

Instantly share code, notes, and snippets.

@lucaswerkmeister
lucaswerkmeister / pipeline.sh
Created December 11, 2016 14:29
Days on which Postfix sent most outgoing emails
journalctl -u postfix -o json | jq -r 'select(.MESSAGE | contains("to=")) | .["_SOURCE_REALTIME_TIMESTAMP"]' | awk '{sec=int($1/(1000*1000)); print sec, int(sec/(60*60*24))}' | uniq -f 1 -c | sort -rn | head | while read count stamp day; do printf '%s\t%s\n' "$count" "$(date -Idate -d @$stamp)"; done
@worker8
worker8 / sed 101
Last active August 18, 2024 12:33
Useful sed regex collection
http://sed.sourceforge.net/sed1line.txt
-------------------------------------------------------------------------
USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005
Compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.5
Latest version of this file (in English) is usually at:
http://sed.sourceforge.net/sed1line.txt
http://www.pement.org/sed/sed1line.txt
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
d-i keyboard-configuration/variant select English (US)
d-i keyboard-configuration/layout select English (US)
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/wireless_wep string
d-i mirror/country string manual
@gurjeet
gurjeet / main.go
Last active September 22, 2022 05:43
Protect gorilla/mux Subroute with basic auth
package main
/*
* This Gist and it's other versions are from:
*
* https://stackoverflow.com/questions/42321789/unable-to-protect-gorilla-mux-subroute-with-basic-auth
*/
import (
"crypto/subtle"
@tuxfight3r
tuxfight3r / sfdisk.sh
Created March 6, 2017 16:01
use sfdisk to create scripted partitions
##create one big partition
echo ';' | sfdisk /dev/sdc
##create one big partition with specific partition type
#creates W95 FAT32 (LBA)
echo ',,c;' | sfdisk /dev/sdd
#creates lvm type
echo ',,8e;' | sfdisk /dev/sdd
@zmts
zmts / tokens.md
Last active June 29, 2025 07:56
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@Mahito
Mahito / docker-compose.yml
Created March 30, 2017 08:38
RabbitMQ monitoring with Prometheus and Grafana
version: '2'
services:
rabbitmq:
image: rabbitmq:3.6.4-management
hostname: rabbitmq
expose:
- "9090"
ports:
- "4369:4369"
- "5671:5671"
@boiyama
boiyama / docker-compose.yml
Last active November 24, 2021 16:05
docker-compose.yml configuring GitLab with Container Registry, Pages, and CI
version: '2'
services:
gitlab:
container_name: gitlab
image: gitlab/gitlab-ce:latest
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
## GitLab configuration settings
##! Check out the latest version of this file to know about the different
@orimanabu
orimanabu / libvirt-qmp-sample.txt
Last active February 5, 2024 16:04
how to run qmp command on a VM invoked via libvirt
# virsh qemu-monitor-command DOMAIN '{"execute": "query-commands"}' --pretty
# virsh qemu-monitor-command DOMAIN --hmp 'help'
# virsh qemu-monitor-command instance-00000002 '{"execute": "query-status"}'
{"return":{"status":"running","singlestep":false,"running":true},"id":"libvirt-5137"}
# virsh qemu-monitor-command instance-00000002 '{"execute": "query-status"}' --pretty
{
"return": {
"status": "running",
@reachlin
reachlin / prometheus.yml
Created April 19, 2017 07:06
sample prometheus configuration explained
// For all the confusing Prometheus configuration and
// regular expressions,
// explained in examples.
// Remember, there are default values for each item if it's missing.
// regex is (.*),
// replacement is $1,
// separator is ;
// ,and action is replace