Skip to content

Instantly share code, notes, and snippets.

View tisaconundrum2's full-sized avatar
🐢
= lambda: [print("🐢", end='') for _ in iter(int, 1)]

Nicholas Finch tisaconundrum2

🐢
= lambda: [print("🐢", end='') for _ in iter(int, 1)]
View GitHub Profile
@evandrix
evandrix / pep20_by_example.py
Created March 13, 2012 18:45
PEP 20 (The Zen of Python) by example
#!/usr/bin/env python
"""
=====================================
PEP 20 (The Zen of Python) by example
=====================================
Usage: %prog
:Author: Hunter Blanks, hblanks@artifex.org / hblanks@monetate.com
@bootchk
bootchk / windowSettable.py
Last active May 1, 2022 16:26
Python, PySide, Qt implementation of saving/restoring window attributes (size, position, etc.) as settings (preferences) for an application. Mixin: make your custom subclass of QMainWindow multiply inherit this, and call these methods from appropriate places.
'''
Copyright 2013 Lloyd Konneker
License: LGPL
'''
from PySide.QtCore import QSettings
class WindowSettable(object):
'''
@grenade
grenade / ServiceDeploy.ps1
Last active October 16, 2024 13:18
Install a Windows service on a remote computer. Set the credentials for the service to run under, grant SeServiceLogonRight to the account and set service recovery options.
<#
.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
@Bonno
Bonno / mp4-to-wav
Created February 10, 2015 09:24
Convert mp4 to WAV with ffmpeg
ffmpeg -i <infile> -ac 2 -f wav <outfile>
@aweijnitz
aweijnitz / install_CUPS_all_defaults.sh
Last active September 28, 2024 15:59
Installing CUPS printer on Debian and add PDF printer
#!/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
"""
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
@espaciomore
espaciomore / watch.sh
Last active August 5, 2024 18:24
Watch command for Git Bash
#!/bin/bash
ARGS="${@}"
clear;
while(true); do
OUTPUT=`$ARGS`
clear
echo -e "${OUTPUT[@]}"
done
@fish2000
fish2000 / almost-ascii-deletion-distance.py
Created March 14, 2017 17:56
Almost ASCII Deletion Distance
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
@porthunt
porthunt / read_github_json.py
Created August 6, 2021 19:49
Read json file from a private GitHub repository
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"