Skip to content

Instantly share code, notes, and snippets.

View airstrike's full-sized avatar
🎯
Focusing

Andy airstrike

🎯
Focusing
View GitHub Profile
@airstrike
airstrike / userstyle.css
Created March 8, 2024 17:43
Hide karma and comment score on HN
@-moz-document domain("news.ycombinator.com") {
/* Hide karma and points on replies */
span.pagetop #karma, span.comhead span.score {
visibility: hidden;
position: relative;
display: inline-block;
height: 10px !important;
overflow: hidden;
}
span.pagetop #karma {
@airstrike
airstrike / setup_sqlcl.sh
Last active January 19, 2024 21:47
Installing modern SQLCL shell at NSU
#!/bin/bash
# Navigate to home directory
cd ~
# Create a 'downloads' directory in the home directory
mkdir -p ~/downloads
# Navigate to the 'downloads' directory
cd ~/downloads
@airstrike
airstrike / sqlcl
Created January 19, 2024 18:38
sqlcl bash script
#!/bin/ksh
# Script to initialize necessary variables to run Oracle 12c - J.K. 01/10/16
#
B=`/usr/bin/tput smso`
OB=`/usr/bin/tput rmso`
ORACLE_SID=NSU12
ORACLE_HOME=/u01/app/oracle/product/19.0.0/client_1
@airstrike
airstrike / .vimrc
Created August 27, 2023 14:26
vscode .vimrc
" VIM user interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set 7 lines to the curors - when moving vertical..
set so=4
set ruler "Always show current position
set cmdheight=1 "The commandbar height
" Set backspace config
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
@airstrike
airstrike / citrix_shenanigans.json
Last active March 6, 2023 20:31 — forked from jdleslie/citrix_ctrl_alt_win.json
Map Apple modifiers (Ctrl, Option, Command) to Windows modifiers (Ctrl, Win, Alt) in Citrix Workspace using Karabiner Elements, with working Alt+Tab and Windows key shortcuts
{
"title": "Citrix Receiver/Workspace shenanigans",
"rules": [
{
"description": "In Citrix, change left_option to Alt key via \"⌘⌥ Command (left)-Option\"",
"manipulators": [
{
"from": {
"key_code": "left_option",
"modifiers": { "optional": [ "any" ] }
@airstrike
airstrike / RemoveHiddenNames.bas
Created October 14, 2020 06:01
Excel VBA: Remove hidden names from workbook
Sub RemoveHiddenNames()
Dim tempname As Name
Application.ScreenUpdating = False
Dim Calc As Long
Calc = xlCalculationManual
If Application.Calculation <> xlCalculationManual Then Calc = xlCalculationSemiautomatic
Application.Calculation = xlCalculationManual
Dim statuspre As String
statuspre = "Deleting hidden names: ["
Dim namecount As Long, deleted As Long
@airstrike
airstrike / FindReplaceInChart.bas
Created July 4, 2020 03:37
Find-Replace formulas in Excel chart
Sub FindReplaceinChart()
Dim mySrs As Series
Dim iPts As Long
Dim iSrs As Long
Dim aLAbel As DataLabel
Dim sFormula As String
If ActiveChart Is Nothing Then
MsgBox "Select a chart and try again.", vbExclamation, "No Chart Selected"
Else
Dim old_ As String, new_ As String
@airstrike
airstrike / process-load.bat
Created April 26, 2020 16:43
Misc process load monitoring snippets for Windows
@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%
@airstrike
airstrike / pretty-django-logging.py
Last active April 18, 2020 03:31
Pretty logging in django
# 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': {
@airstrike
airstrike / subquery-join-traceback
Created April 16, 2020 01:25
Traceback for subquery-join error upon evaluating the same Subquery twice in a row
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