Skip to content

Instantly share code, notes, and snippets.

@mcchae
mcchae / figlet.out
Created Jan 7, 2019
pyfiglet ascii art for python usage example
View figlet.out
Font=1943____
### ## #### #### ### # # ## ## ### # # ### # # ####
## ## #### #### ### # # ## ## ### # # ### # # ####
## ## #### #### ### # # ## ## ### # # ### # # ####
## ### ## #### # # ### # # ## # ## ### # # ### # # # # ## # ## ##
## ## ## ## # ### # ### ### # # # ### # ### # # ### # # # ### ## ## ## ## ##
## ## ### #### ### #### ### #### ### # # ## ## ### # # ### # # ### #### ## ### ##### ##
### ## ## ## ### #### ### #### ### # # ## ## ### # # ### # # ### #### # ## # ### ##
## ## # # ### # # ### ### # # ### # # ### # # # # ### ## ## # ## ##
#### #### #### ### # # ### # # ### # #
@mcchae
mcchae / debug_dynamic_code.py
Created May 8, 2018
PyCharm debug with dynamic code
View debug_dynamic_code.py
#!/usr/bin/env python
# coding=utf8
################################################################################
import os
import importlib.util
################################################################################
@mcchae
mcchae / api.php
Created May 2, 2018
python client <=> php service sample code
View api.php
<?php
// get the HTTP http_method, path and body of the request
$http_method = $_SERVER['REQUEST_METHOD'];
$request = explode('/', trim($_SERVER['PATH_INFO'],'/'));
$input = json_decode(file_get_contents('php://input'),true);
// retrieve the method and key from the path
$method = preg_replace('/[^a-z0-9_]+/i','',array_shift($request));
$key = array_shift($request);
@mcchae
mcchae / email_send.py
Created Apr 30, 2018
python gmail send
View email_send.py
import os
import smtplib
import time
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email.utils import COMMASPACE, formatdate
from email import encoders
@mcchae
mcchae / google-map-search.py
Last active Jun 28, 2018
Some python selenium examples
View google-map-search.py
#!/usr/bin/env python
################################################################################
import sys
from time import sleep
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
@mcchae
mcchae / Modules.Setup
Created Sep 23, 2017
dockcross ARMv5 python build
View Modules.Setup
# -*- makefile -*-
# The file Setup is used by the makesetup script to construct the files
# Makefile and config.c, from Makefile.pre and config.c.in,
# respectively. The file Setup itself is initially copied from
# Setup.dist; once it exists it will not be overwritten, so you can edit
# Setup to your heart's content. Note that Makefile.pre is created
# from Makefile.pre.in by the toplevel configure script.
# (VPATH notes: Setup and Makefile.pre are in the build directory, as
# are Makefile and config.c; the *.in and *.dist files are in the source
@mcchae
mcchae / acl_test.py
Created Sep 5, 2017
AAA Authorization with miracle_acl
View acl_test.py
#!/usr/bin/env python
# coding=utf8
###############################################################################
from miracle.acl import Acl
from pprint import pformat
###############################################################################
def acl_test():
@mcchae
mcchae / image_diff.py
Created Aug 24, 2017
Python OpenCV Image diff
View image_diff.py
# USAGE
# python image_diff.py --first images/original_01.png --second images/modified_01.png
# import the necessary packages
from skimage.measure import compare_ssim
import argparse
import imutils
import cv2
# construct the argument parse and parse the arguments
@mcchae
mcchae / index.py
Last active Aug 29, 2018
CVE search engine using python Whoosh
View index.py
#!/usr/bin/env python
# coding=utf-8
"""
import CVE from "http://cve.mitre.org/data/downloads/allitems.txt"
"""
################################################################################
import os
import urllib2
import getopt
@mcchae
mcchae / sendslack.json
Created Dec 23, 2016
sendslack is a simple program to send a message to slack communication app
View sendslack.json
{
"token":"xoxp-1_________75-10________93-11________40-4d________c382e04140057________",
"channels": [
{
"name": "_imo_devops_",
"incoming_webhook_url": "https://hooks.slack.com/services/T________/__________/______________________",
"icon_emoji": ":shipit:"
},
{
"name": "_imo_do1_unittest_",
You can’t perform that action at this time.