Skip to content

Instantly share code, notes, and snippets.

@loganvolkers
loganvolkers / Byte Formatting for Google Sheets.md
Last active April 16, 2024 10:42
Byte formatting for Google Sheets
@johncf
johncf / mui2-custompage-nsd.nsi
Last active August 29, 2023 06:28
NSIS Example using MUI2 with a custom page built with NsDialogs.
!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 December 12, 2017 12:23
Gunicorn Python cProfile for Python 3.6
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)))
@scottsb
scottsb / paypal-id-formats.md
Last active June 2, 2020 14:10
PayPal API ID Prefix Formats

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

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 November 17, 2021 17:27
Example of stopping and uninstalling service using nsis
!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 December 15, 2015 16:22
Measure the time taken by some Python code
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 June 2, 2015 17:35
why aren't all objective-C programs written in python?
#!/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 April 17, 2024 11:47
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/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.
@fernandoaleman
fernandoaleman / rpm-digital-signature.sh
Created November 18, 2011 15:18
How to sign your custom RPM package with GPG key
# How to sign your custom RPM package with GPG key
# Step: 1
# Generate gpg key pair (public key and private key)
#
# You will be prompted with a series of questions about encryption.
# Simply select the default values presented. You will also be asked
# to create a Real Name, Email Address and Comment (comment optional).
#
# If you get the following response: