Skip to content

Instantly share code, notes, and snippets.

View AlmightyOatmeal's full-sized avatar

Cat AlmightyOatmeal

View GitHub Profile
@AlmightyOatmeal
AlmightyOatmeal / python.list.fun.py
Last active May 8, 2018 22:42
Fun with Python lists! Works on Python 2.7.x.
def list_chunker(list_obj, chunk_size):
"""Break apart a list into smaller lists as a generator.
:param list_obj: Array of single values in which to be chunkersized.
:type list_obj: list or set
:param chunk_size: Size of the resulting generated lists.
:type chunk_size: int
:return: List of the specified size or last remaining items.
:rtype: list
"""
@AlmightyOatmeal
AlmightyOatmeal / python.subprocess.py
Last active May 8, 2018 23:01
Fun with Python subprocess! Works on Python 2.7.x.
import json
import logging
import os
import subprocess
logger = logging.getLogger(os.path.splitext(os.path.basename(__file__))[0])
# If you have ever used jq and tried to use it in Python but ran into
@AlmightyOatmeal
AlmightyOatmeal / python.mimetypes.py
Last active May 8, 2018 23:04
Fun with Python and mimetypes! Works in Python 2.7.x.
import mimetypes
import os
def find_files(root, accepted_types=None):
"""Walk a path and find files that are a specific type, regardless of extension.
:param root: Path to start walking for files.
:type root: str
:param accepted_types: (optional) List of acceptable mimetypes to match.
@AlmightyOatmeal
AlmightyOatmeal / gist:d5e2f00125cd68d99b3b3533c80378f2
Created January 26, 2019 01:47 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: ๐Ÿ˜„ :smile: ๐Ÿ˜† :laughing:
๐Ÿ˜Š :blush: ๐Ÿ˜ƒ :smiley: โ˜บ๏ธ :relaxed:
๐Ÿ˜ :smirk: ๐Ÿ˜ :heart_eyes: ๐Ÿ˜˜ :kissing_heart:
๐Ÿ˜š :kissing_closed_eyes: ๐Ÿ˜ณ :flushed: ๐Ÿ˜Œ :relieved:
๐Ÿ˜† :satisfied: ๐Ÿ˜ :grin: ๐Ÿ˜‰ :wink:
๐Ÿ˜œ :stuck_out_tongue_winking_eye: ๐Ÿ˜ :stuck_out_tongue_closed_eyes: ๐Ÿ˜€ :grinning:
๐Ÿ˜— :kissing: ๐Ÿ˜™ :kissing_smiling_eyes: ๐Ÿ˜› :stuck_out_tongue:
@AlmightyOatmeal
AlmightyOatmeal / README.md
Created May 15, 2019 20:34 — forked from steve-jansen/README.md
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@AlmightyOatmeal
AlmightyOatmeal / __init__.py
Last active February 9, 2024 16:26
mod_jamie
"""Welcome to the tomorrow of yesterday.
"""
import logging
import urllib3
# Disable `InsecureRequestWarning: Unverified HTTPS request is being made to host '...' ...` messages.
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# ^ Alternatively, one can set the environmental variable:
# PYTHONWARNINGS="ignore:Unverified HTTPS request"
# Base64 encode an image
$ echo "geek_ninja-glow.png" | python -c 'import base64, mimetypes, os, sys; filename=os.path.abspath(sys.stdin.read().strip()); file_mime=mimetypes.guess_type(filename, strict=True)[0]; file_data=base64.b64encode(open(filename, "rb").read()); print(""); print("<img src=\"data:{};base64,{}\">".format(file_mime, file_data))'โ€จ
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...<snip>...yFo9lYcuhxyAAAAAElFTkSuQmCC">