Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Herrmann mherrmann

View GitHub Profile
@loganvolkers
loganvolkers / Byte Formatting for Google Sheets.md
Last active Jul 28, 2022
Byte formatting for Google Sheets
View Byte Formatting for Google Sheets.md
@johncf
johncf / mui2-custompage-nsd.nsi
Last active Jan 14, 2022
NSIS Example using MUI2 with a custom page built with NsDialogs.
View mui2-custompage-nsd.nsi
!include nsDialogs.nsh
!include LogicLib.nsh
!include MUI2.nsh
Name nsDialogs
OutFile nsDialogs.exe
RequestExecutionLevel user
ShowInstDetails show
Var Dialog
@michaeltcoelho
michaeltcoelho / gunicorn_profile.py
Created Dec 12, 2017
Gunicorn Python cProfile for Python 3.6
View gunicorn_profile.py
import cProfile
import pstats
from io import StringIO
import logging
import os
import time
PROFILE_LIMIT = int(os.environ.get("PROFILE_LIMIT", 30))
PROFILER = bool(int(os.environ.get("PROFILER", 1)))
@mstuttgart
mstuttgart / dark_fusion.py
Created Apr 29, 2017 — forked from lschmierer/dark_fusion.py
Qt5 Dark Fusion Palette for Python
View dark_fusion.py
qApp.setStyle("Fusion")
dark_palette = QPalette()
dark_palette.setColor(QPalette.Window, QColor(53, 53, 53))
dark_palette.setColor(QPalette.WindowText, Qt.white)
dark_palette.setColor(QPalette.Base, QColor(25, 25, 25))
dark_palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
dark_palette.setColor(QPalette.ToolTipBase, Qt.white)
dark_palette.setColor(QPalette.ToolTipText, Qt.white)
@scottsb
scottsb / paypal-id-formats.md
Last active Jun 2, 2020
PayPal API ID Prefix Formats
View paypal-id-formats.md

PayPal API ID Prefix Formats

PayPal uses various prefixes to distinguish different types of unique IDs in their APIs, but these are not currently documented in a single place. This Gist seeks to bring that information together into a single place. If there is something missing, please reach out through one of the channels on my GitHub profile since GitHub doesn't send notifications on Gist comments.

Formats

View integration.py
import jwt
import requests
from time import time
pem_file = '/path/to/github.pem' # the absolute path to your Application Pem Certificate issued by GitHub
integration_id = 0 # GitHub Application Integration ID
installation_id = 0 # once installed on an organization. The Organization Integration ID
expire_seconds = 500 # number of seconds the jwt token expires (max ~600 but not designated by GitHub)
slug = 'owner/repo' # name of repo for demo purposes
@cpoDesign
cpoDesign / stopAndUninstallService.nsi
Last active Nov 17, 2021
Example of stopping and uninstalling service using nsis
View stopAndUninstallService.nsi
!define APPNAME "App Name"
!define COMPANYNAME "Company Name"
!define DESCRIPTION "A short description goes here"
# These three must be integers
!define VERSIONMAJOR 1
!define VERSIONMINOR 1
!define VERSIONBUILD 1
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "http://..." # "Support Information" link
@mherrmann
mherrmann / timer.py
Last active Dec 15, 2015
Measure the time taken by some Python code
View timer.py
from collections import OrderedDict
from time import time
class Timer(object):
"""
Measure the time taken by some Python code, incl. its subtasks:
>>> with Timer('parent') as timer:
... sleep(0.5)
... with timer.child('child') as child:
@mRB0
mRB0 / gist:740c25fdae3dc0b0ee7a
Created Jun 2, 2015
why aren't all objective-C programs written in python?
View gist:740c25fdae3dc0b0ee7a
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from contextlib import contextmanager
import ctypes
import ctypes.util
from ctypes import CFUNCTYPE
objc = ctypes.cdll.LoadLibrary(ctypes.util.find_library('objc'))
@niksumeiko
niksumeiko / git.migrate
Last active Aug 16, 2022
Moving git repository and all its branches, tags to a new remote repository keeping commits history
View git.migrate
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.