Skip to content

Instantly share code, notes, and snippets.

kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@goliatone
goliatone / mongo-docker.bash
Created July 4, 2016 23:57 — forked from davideicardi/mongo-docker.bash
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
@tasdikrahman
tasdikrahman / python_tests_dir_structure.md
Last active July 27, 2024 00:22
Typical Directory structure for python tests

A Typical directory structure for running tests using unittest

Ref : stackoverflow

The best solution in my opinion is to use the unittest [command line interface][1] which will add the directory to the sys.path so you don't have to (done in the TestLoader class).

For example for a directory structure like this:

new_project

├── antigravity.py

@czardoz
czardoz / pre-commit.sh
Last active October 3, 2022 12:13
Git pre-commit hook that checks for AWS keys
#!/usr/bin/env bash
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
EMPTY_TREE=$(git hash-object -t tree /dev/null)
against=$EMPTY_TREE
fi
@sebdah
sebdah / threading_example.py
Last active July 18, 2024 14:35
Running a background thread in Python
import threading
import time
class ThreadingExample(object):
""" Threading example class
The run() method will be started and it will run in the background
until the application exits.
"""
@leedavis81
leedavis81 / delete-core.sh
Created October 11, 2012 16:57
Delete a solr core
#!/bin/bash
clear
echo "*************************************************************************"
echo "*************************************************************************"
echo
echo " You are about to *permanently* delete a core!"
echo " There is no going back"
echo
echo "*************************************************************************"

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: