Skip to content

Instantly share code, notes, and snippets.

@optionalg
optionalg / ssh-keys.md
Created August 16, 2017 06:03 — forked from arjenblokzijl/ssh-keys.md
Setup SSH keys

SSH keys

1. Create

ssh-keygen -t rsa

2. Store the keys (and passphrase)

Once you have entered the Gen Key command, you will get a few more questions:

@optionalg
optionalg / imap_monitor
Created August 16, 2017 05:20 — forked from shimofuri/imap_monitor
Python script for monitoring an IMAP folder
Each existing unread and subsequent new emails after the script is started are
passed as Mail objects to "process_email" function.Function header is provided
but processing implementation is left to the user. Error logs are currently sent
to a rotating log file (in the same directory as the script) and to STDOUT.
Instead of polling or checking the server for new emails every now and then,
IMAP IDLE check is utilized. Ensure that the IMAP server supports IDLE command
and allows at least 5 minutes of idling*** and uses the default ports for this
script to work. Tested to work with Gmail and default installations of MS
Exchange Server.
def BaseSeven(num):
powersOfSeven = 1;
res = 0;
while num / powersOfSeven > 6: powersOfSeven = powersOfSeven * 7
while powersOfSeven != 1:
res = res * 10 + int(num / powersOfSeven)
num = num - int(num / powersOfSeven) * powersOfSeven
powersOfSeven = powersOfSeven / 7
res = res * 10 + num
return res
class BaseSevenNumber:
def __init__(self):
self.digits = [1]
def Double(self):
for i in range(0, len(self.digits)):
self.digits[i] = self.digits[i] * 2
for i in range(len(self.digits) - 1, -1, -1):
if self.digits[i] > 6:
@optionalg
optionalg / filter.py
Created August 16, 2017 04:57 — forked from Motoma/filter.py
filter.py
#!/usr/bin/env python
import os
import pickle
import random
import sys
import beanstalkc
# Use *'s sparingly!
@optionalg
optionalg / queuer.py
Created August 16, 2017 04:56 — forked from Motoma/queuer.py
queuer.py
#!/usr/bin/env python
import os
import pickle
import time
import beanstalkc
# Images are stored locally in 'images', and moved to 'original' when
# they have been passed to the queue
#! /usr/bin/env python
from os import system
from urllib2 import urlopen
from socket import socket
from sys import argv
from time import asctime
def tcp_test(server_info):
cpos = server_info.find(':')
@optionalg
optionalg / pen-test-app.py
Created August 16, 2017 01:08 — forked from NickDeClario/pen-test-app.py
Simple Python ZAP API Implementation
#!/usr/bin/env python
import sys
import time
import json
import argparse
import re
from zapv2 import ZAPv2
#!/usr/bin/python
from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def home():
text = None
if request.method == 'POST':
if request.form['submit']:
@optionalg
optionalg / build_tasks.py
Created August 16, 2017 00:28 — forked from diyan/build_tasks.py
Buld script for Python project (virtualenv, pip with requirement file, pylint, py.test, coverage, Jenkins CI) which could be executed from both system and virtual environment
import os
import sys
# One or several build tasks could be executed from Jenkins CI as following:
# #!/bin/bash
# cd $WORKSPACE/release_system/src/build/
# python -c 'from build_tasks import *; code_analysis(); run_tests()'
class BuildEnvironment(object):