This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo nmap --min-hostgroup 100 -F -sS -n -T4 $IP/32 | |
nc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER SEQUENCE id_seq_player RENAME TO player_id_seq; # rename a sequence artifact | |
ALTER SEQUENCE model_id_seq RESTART WITH 1; # there is also select setval(); | |
# Remove connections from a certain DB, useful for ill-finished test runs. | |
SELECT pid, pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='DB_NAME'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rm --cached filename # Remove a file from repository without removing it locally | |
git reset --hard HEAD~2 # Delete last 2 commits, code included | |
git diff --name-only $commit # State the files changed in a commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[00;33m\]\$(git_branch)\[\033[00m\]\$ " | |
alias g='git' | |
source /usr/share/bash-completion/completions/git | |
complete -o default -o nospace -F _git g |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipenv -h | |
pipenv install | |
pipenv --python3.7 | |
pipenv shell | |
pipenv install --dev sphinx | |
pipenv install --dev sphinx --skip-lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import logging | |
import sqlite3 | |
import pytest | |
logger = logging.getLogger("ExampleDBClient") | |
RECONNECT_SLEEP = 30 | |
RECONNECT_ATTEMPTS = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Testing that your program respond as expected in negative situations is very important. | |
These tests exemplify how to check that some code raises the right Exception. | |
""" | |
# TODO BreakingPoint exception | |
import pytest | |
def raise_exception(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num_list = [] | |
def add_num(num): | |
num_list.append(num) | |
return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This example has not been tested. Use it as a reference only. | |
""" | |
import psycopg2 | |
import pytest | |
USER = "postgres" | |
PASS = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import random | |
import string | |
import unicodedata | |
from uuid import uuid4 | |
from functools import partial | |
from _datetime import datetime, timezone | |
from factory import Factory, Sequence, LazyFunction as LF, LazyAttribute as LA | |
from factory.fuzzy import FuzzyChoice as Choice |