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
@echo off | |
rem CPU load by process (e.g. python*) | |
echo "Python processes % Processor Time" | |
typeperf "\Process(python*)\% Processor Time" -sc 10 | grep / | sed -r 's/.*:(.*)/\1/g' | sed -r 's/[\",]+/ /g' | |
rem Total CPU Load | |
echo "Total CPU Load %" | |
@for /f %p in ('wmic cpu get loadpercentage ^| grep -P \d+') do @echo %p% |
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
# add to settings.py | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': True, | |
'loggers': { | |
'django.db.backends': { | |
'handlers': ['console_sql'], | |
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO').upper(), | |
}, | |
'cache': { |
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
C:\projects\fundraiser fundraiser λ python manage.py shell | |
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32 | |
Type "help", "copyright", "credits" or "license" for more information. | |
(InteractiveConsole) | |
>>> from fundraising.models import * | |
>>> from django.db.models.sql.constants import LOUTER | |
>>> from django.db.models import * | |
>>> donations = Donation.objects.values('week').annotate(agg=Sum('amount')).filter(membership__group__id=OuterRef('membership__group_id')) | |
>>> groups = Group.objects.annotate(amounts=Subquery(donations, join=True, join_type=LOUTER)) | |
>>> groups |
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
Option Explicit | |
Sub InterpolateFontColor() | |
Dim rng As Range, lowpointColor As Long, highpointColor As Long, midpointColor As Long | |
'Get A Cell Address From The User to Get Number Format From | |
On Error Resume Next | |
Set rng = Application.InputBox( _ | |
Title:="Interpolate Font Color in Cells", _ | |
Prompt:="Select cell range to interpolate", _ | |
Type:=8) |
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
-- What I have | |
-- >>> from django.db.models.expressions import * | |
-- >>> from foo.utils import GroupConcat | |
-- GroupConcat is essentially just a string aggregator... code is here if you're curious https://dpaste.org/Twpu/slim#L15,20 | |
-- >>> window = {'partition_by': [F('id'),], 'order_by': [F('workload__submission__employee__role__level').desc(),], 'frame': RowRange()} | |
-- >>> Project.objects.annotate(team=Window(expression=GroupConcat('workload__submission__employee__goes_by'), **window)) | |
SELECT | |
"staffing_project"."id", | |
"staffing_project"."name", |
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
#SingleInstance | |
#Persistent | |
RAlt & z:: | |
reload | |
return | |
DetectHiddenWindows, On | |
F1::return ;F1 does nothing |
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
// Uncompressed version of dungeon generator, backported for MS Visual Studio 2008 | |
// Original work: https://gist.github.com/munificent/b1bcd969063da3e6c298be070a22b604 | |
// Original uncompressed version: https://gist.github.com/Joker-vD/cc5372a349559b9d1a3b220d5eaf2b01 | |
// Tested with Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64 | |
#include <time.h> // Robert Nystrom | |
#include <stdio.h> // @munificentbob | |
#include <stdlib.h> // for Ginny | |
// #include <stdbool.h> // 2008-2019 | |
typedef int bool; |
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
/* | |
From https://github.com/romainl/flattened | |
TERMCOL HEX RGB | |
------- ------- ----------- | |
black #073642 7 54 66 | |
red #dc322f 220 50 47 | |
green #859900 133 153 0 | |
yellow #b58900 181 137 0 | |
blue #268bd2 38 139 210 | |
magenta #d33682 211 54 130 |
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
" VIM user interface | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
set so=2 " Show at least 2 lines around cursors when moving vertically | |
set ruler "Always show current position | |
set cmdheight=1 "The commandbar height | |
" Set backspace config | |
set backspace=eol,start,indent | |
set whichwrap+=<,>,h,l |
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
#======================================================================== | |
# Description: Tokenise an Excel formula using an implementation of | |
# E. W. Bachtal's algorithm, found here: | |
# | |
# Blog post: https://ewbi.blogs.com/develops/2004/12/excel_formula_p.html | |
# See also: https://ewbi.blogs.com/develops/popular/excelformulaparsing.html | |
# Direct link to this port: http://www.ewbi.com/ewbi.develop/samples/jsport_nonEAT.py | |
# | |
# Originally written for Python v2.5 (win32) | |
# Author: Robin Macharg |