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
| #!/bin/bash | |
| RED="\[\033[0;31m\]" | |
| YELLOW="\[\033[0;33m\]" | |
| GREEN="\[\033[0;32m\]" | |
| BLUE="\[\033[0;34m\]" | |
| LIGHT_RED="\[\033[1;31m\]" | |
| LIGHT_GREEN="\[\033[1;32m\]" | |
| WHITE="\[\033[1;37m\]" | |
| LIGHT_GRAY="\[\033[0;37m\]" |
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
| #!/bin/bash | |
| # | |
| # Script: pgmigrate.sh | |
| # Author: Mathieu D. (MatToufoutu) | |
| # Description: Automated schema migration for PostgreSQL | |
| # Usage: ./pgmigrate.sh DATABASE MIGRATIONS_FOLDER | |
| # | |
| # Details: | |
| # Just store the .sql migrations scripts in a folder, file | |
| # names must be incremental numbers (1.sql, 2.sql, ...). |
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
| COLOR_CODES = { | |
| 'green': '\033[32m', | |
| 'bgreen': '\033[1;32m', | |
| 'bgrey': '\033[1;30m', | |
| 'reset': '\033[0m' | |
| } | |
| def color(text, color_name): | |
| return COLOR_CODES[color_name]+text+COLOR_CODES['reset'] |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # curly.py - Easily communicate with JSON APIs. | |
| # | |
| # TODO: | |
| # - allow any http method | |
| # - output equivalent curl command | |
| # - allow http basic auth | |
| # |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # restest.py - Easily communicate with JSON APIs. | |
| # | |
| import sys | |
| from argparse import ArgumentParser | |
| from urllib import urlencode | |
| from urllib2 import build_opener, HTTPError |
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
| class Singleton(type): | |
| def __init__(cls, *args, **kwargs): | |
| # When creating the class object (class ClassName), set the shared instance variable. | |
| super(Singleton, cls).__new__(*args, **kwargs) | |
| cls.__instance = None | |
| def __call__(cls, *args, **kwargs): | |
| # When instanciating (obj = ClassName()), return shared instance (or create it if 1st time). | |
| if cls.__instance is None: | |
| cls.__instance = super(Singleton, cls).__call__(*args, **kwargs) |
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
| function loadavg_info() { | |
| local -h one five fifteen rest | |
| read one five fifteen rest < /proc/loadavg | |
| print "$one $five $fifteen" | |
| } | |
| function prompt_char { | |
| if [[ `whoami` == 'root' ]]; then | |
| print "#" | |
| else |
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 os | |
| from time import sleep | |
| file_path = '/foo/bar/suce.txt' | |
| while True: | |
| if os.path.exists(file_path): | |
| data = open(file_path).read() | |
| # faire des trucs avec le contenu du fichier ici | |
| break |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import sys | |
| from threading import Thread | |
| from Queue import Empty, Queue | |
| from urlparse import urlparse | |
| todo = Queue() |
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
| -N PORTSCAN | |
| -A PORTSCAN -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP | |
| -A PORTSCAN -p tcp --tcp-flags ALL ALL -j DROP | |
| -A PORTSCAN -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP | |
| -A PORTSCAN -p tcp --tcp-flags SYN,RST SYN,RST -j DROP | |
| -A PORTSCAN -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP |