Skip to content

Instantly share code, notes, and snippets.

@JarekParal
JarekParal / README.md
Created December 9, 2019 15:57
Pyinstaller - update version during CI build / automatic update of version file
python CI/updateVersion.py %NEW_VERSION%
pyinstaller testApp.py --version-file "CI/version.py"
@mklement0
mklement0 / Time-Command.ps1
Last active November 19, 2023 17:08
PowerShell function that times the execution of one or more commands, averaged over a specifiable number of runs.
<#
Prerequisites: PowerShell v5.1 and above (verified; may also work in earlier versions)
License: MIT
Author: Michael Klement <mklement0@gmail.com>
DOWNLOAD and DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/9e1f13978620b09ab2d15da5535d1b27/raw/Time-Command.ps1 | iex
@SeanSobey
SeanSobey / .gitattributes
Last active November 4, 2022 08:57
Git to diff zip (or any compressed) files. See this (https://tante.cc/2010/06/23/managing-zip-based-file-formats-in-git/) article.
*.[7z,xz,bzip2,gzip,tar,zip,wim,ar,arj,cab,chm,cpio,cramfs,dmg,ext,fat,gpt,hfs,ihex,iso,lzh,lzma,mbr,.msi,nsis,ntfs,qcow2,rar,rpm,squashfs,udf,uefi,vdi,vhd,vmdk,wim,xar,z] diff=archive
ffmpeg -i data/video.mp4 -vcodec h264 -b:v 1000k -acodec mp2 data/output.mp4
@JasonKleban
JasonKleban / LiteEvent.ts
Last active January 26, 2023 06:33
TypeScript LiteEvent Events implementation
interface ILiteEvent<T> {
on(handler: { (data?: T): void }) : void;
off(handler: { (data?: T): void }) : void;
}
class LiteEvent<T> implements ILiteEvent<T> {
private handlers: { (data?: T): void; }[] = [];
public on(handler: { (data?: T): void }) : void {
this.handlers.push(handler);
@EdwinChan
EdwinChan / nested.py
Last active May 8, 2024 20:58
Trick for using multiprocessing with nested functions and lambda expressions
import concurrent.futures
import multiprocessing
import sys
import uuid
def globalize(func):
def result(*args, **kwargs):
return func(*args, **kwargs)
result.__name__ = result.__qualname__ = uuid.uuid4().hex
setattr(sys.modules[result.__module__], result.__name__, result)
@peace098beat
peace098beat / MainApplication.py
Created April 28, 2015 12:18
[PyQt] Drag and Drop files
class MainWidget(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWidget, self).__init__(parent)
self.setWindowTitle("FiFiFactory App")
self.resize(720,480)
self.setAcceptDrops(True)
def dragEnterEvent(self, event):
if event.mimeData().hasUrls():
event.accept()
@da-n
da-n / gist:9998623
Created April 5, 2014 22:01
Rename a tag in git

Rename a git tag old to new:

git tag new old
git tag -d old
git push origin :refs/tags/old
git push --tags

The colon in the push command removes the tag from the remote repository. If you don't do this, git will create the old tag on your machine when you pull.

-- source http://stackoverflow.com/a/5719854/695454

@samuraisam
samuraisam / deep_eq.py
Last active March 29, 2024 22:17
Deep Equality Test for Nested Python Structures
#Copyright (c) 2010-2013 Samuel Sutch [samuel.sutch@gmail.com]
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in