This file contains 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 | |
""" | |
===================================== | |
PEP 20 (The Zen of Python) by example | |
===================================== | |
Usage: %prog | |
:Author: Hunter Blanks, hblanks@artifex.org / hblanks@monetate.com |
This file contains 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
''' | |
Copyright 2013 Lloyd Konneker | |
License: LGPL | |
''' | |
from PySide.QtCore import QSettings | |
class WindowSettable(object): | |
''' |
This file contains 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
<# | |
.Synopsis | |
Installs a Windows service on a remote computer. | |
Sets the credentials for the service to run under. | |
Grants SeServiceLogonRight to the account. | |
Sets service recovery options. | |
.Parameter computerName | |
Defines the name of the computer which will host the service. | |
Default is the local computer on which the script is run. | |
.Parameter name |
This file contains 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
ffmpeg -i <infile> -ac 2 -f wav <outfile> |
This file contains 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 | |
sudo apt-get -y install cups | |
sudo apt-get -y install cups-pdf | |
# add pdf printer to cups | |
# - named files end up in ~/PDF/ | |
# - unnamed files are stored in /var/spool/cups-pdf/ANONYMOUS/, such as PDF:s created by streaming bytes over an API | |
sudo lpadmin -p cups-pdf -v cups-pdf:/ -E -P /usr/share/ppd/cups-pdf/CUPS-PDF.ppd |
This file contains 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
""" | |
Converts a large CSV into SQL, can process some of the smaller chunks | |
Based on https://plot.ly/python/big-data-analytics-with-pandas-and-sqlite/ | |
Original code probably from https://github.com/chriddyp | |
""" | |
import pandas | |
from sqlalchemy import create_engine | |
import tqdm |
This file contains 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 | |
ARGS="${@}" | |
clear; | |
while(true); do | |
OUTPUT=`$ARGS` | |
clear | |
echo -e "${OUTPUT[@]}" | |
done |
This file contains 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
def ascii_deletion_distance(str1, str2): | |
from collections import defaultdict | |
histogram = defaultdict(int) | |
for ch in str1: | |
histogram[ch] += 1 | |
for ch in str2: | |
histogram[ch] += 1 | |
union = set(str1) | set(str2) | |
intersection = set(str1) & set(str2) | |
result = union - intersection |
This file contains 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 base64 | |
import json | |
import requests | |
REPO_URL = "https://api.github.com/repos/<USER>/<REPO>/contents/<PATH>/<TO>/<FILE>.json" | |
TOKEN = "<YOUR PAT OR OAUTH TOKEN>" | |
headers = { | |
"Authorization": f"token {TOKEN}", | |
"Accept": "application/vnd.github.v4+raw" |