Skip to content

Instantly share code, notes, and snippets.

@romanmah
romanmah / redis-mygrate.py
Created March 20, 2014 14:03
A small utility for redis db migration
#!/usr/bin/python
import redis
import pickle
import argparse
class RedisMigrate():
def __init__(self, host, port, db):
@liquidgecka
liquidgecka / cron_helper.sh
Last active September 28, 2023 15:35
Cron helper
#!/bin/bash
usage() {
cat << EOF
Usage: $0 [OPTION]... COMMAND
Execute the given command in a way that works safely with cron. This should
typically be used inside of a cron job definition like so:
* * * * * $(which "$0") [OPTION]... COMMAND
Arguments:
@mandiwise
mandiwise / Count lines in Git repo
Last active July 4, 2024 16:56
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@AmShaegar13
AmShaegar13 / outdated_files_query.js
Last active April 17, 2024 15:34
Delete outdated files from Rocket.Chat
/**
* MongoDB query to delete outdated files from Rocket.Chat. You can specify the number of DAYS
* before a file is considered outdated. Deleted files are removed from GridFS completely keeping
* only the message in chat. The message is modified to be a link that points to ALT_LINK instead
* of the file and '(deleted)' is appended to the title.
*
* Tested with MongoDB 3.4
*/
const DAYS = 60;
@epcim
epcim / kubernetes_pods_docker_disk_usage.md
Last active June 4, 2024 05:31
docker disk space introspection kubernetes docker overlay

identify big pods/containers

investigage big files

DST=/mnt
find /var/lib -type f -size +1G -exec ls -lh {} \; | tee  $DST/bigfiles_var_lib_$(date "+%H%M").log
find /var/lib -type f -size +1G -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -rh > $DST/bigfiles_var_lib_$(date "+%H%M").sorted.log

misbehave processes