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 | |
set -eu | |
REVS='roots(~ancestors(roots(trunk())))' | |
DEST='trunk()' | |
branches_to_delete() { | |
# Return all branches that point to immutable heads, except for the main one. | |
# Branches may have changed on the remote (e.g. deleted), so remove the asterisk marker. | |
jj log --no-graph -T 'local_branches.join("\n")' -r 'immutable_heads()' | grep -v -E '^(main|master|trunk)$' | sed 's/*$//' |
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
# This is a systemd user service | |
# | |
[Unit] | |
Description=Start krfb | |
After=graphical-session.target | |
[Service] | |
Type=exec | |
ExecStart=krfb --display $DISPLAY --nodialog | |
Restart=always |
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
__all__ = ( | |
FormatMessageSystem, | |
LCID_ENGLISH, | |
LCID_NEUTRAL, | |
) | |
import ctypes | |
import ctypes.wintypes | |
LANG_NEUTRAL = 0x00 |
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 | |
token() { | |
echo -n 'Authorization: Bearer YOUR_TOKEN_HERE' | |
} | |
acurl() { | |
curl \ | |
-H 'tz: America/New_York' \ | |
-H "$(token)" \ |
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 platform | |
#wnd is a HWND | |
def forceFocus(wnd): | |
if platform.system() != 'Windows': | |
return | |
SPI_GETFOREGROUNDLOCKTIMEOUT = 0x2000 | |
SPI_SETFOREGROUNDLOCKTIMEOUT = 0x2001 | |
SW_RESTORE = 9 |
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
__all__ = ( | |
####### Class Objects | |
#CoGetClassObject - Normal, not wrapped | |
'CoDllGetClassObject', #Get ClassObject from a DLL file | |
####### ClassFactory::CreateInstance Wrappers | |
'CoCreateInstanceFromFactory', #Create an object via IClassFactory::CreateInstance | |
'CoCreateInstanceFromFactoryLicenced', #Create a licenced object via IClassFactory2::CreateInstanceLic |
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
#Some utilities to work with django models and foreign keys. | |
#Especially useful for finding (and writing out) code to illuminate information about relations. | |
# | |
#To try it out, run show_relation_accessors(model) in a python prompt, or to be more general, get_related_instance_ids_code(model) | |
# | |
#-2011 CBWhiz | |
# | |
# | |
#Usage sample: | |
# from django.db import transaction |
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 os | |
import sys | |
import ctypes | |
ES_AWAYMODE_REQUIRED = 0x00000040 | |
ES_CONTINUOUS = 0x80000000 | |
ES_DISPLAY_REQUIRED = 0x2 #Forces the display to be on by resetting the display idle timer. | |
ES_SYSTEM_REQUIRED = 0x1 #Forces the system to be in the working state by resetting the system idle timer. |
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 subprocess | |
import signal | |
def pipeline(cmds, first_stdin=None, last_stdout=None): | |
"""Pipe together programs using subprocess""" | |
pcount = len(cmds) | |
plist = [] | |
for i, cmd in enumerate(cmds): | |
stdin = None | |
stdout = None |
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 sys; import os; _p = os.path.join(sys.real_prefix, 'lib', 'site-packages'); sys.path.append(_p); import sip; import PyQt4; sys.path.remove(_p) |
NewerOlder