Skip to content

Instantly share code, notes, and snippets.

View boarnoah's full-sized avatar

Adipa Wijayathilaka boarnoah

View GitHub Profile
@boarnoah
boarnoah / pre-commit.ps1
Last active August 31, 2023 18:49
Pre Commit hook for Prettier, dotnet format & terraform format. Relatively fast, only runs lints relevant to commit= content.
# Powershell scripts can be used in .git/hooks very easily ex:
# #!/usr/bin/env sh
# pwsh -noprofile -F "C:\Code\pre-commit.ps1"
$files = (git diff --cached --name-only --diff-filter=ACM);
if ( $files -like '*.tf' ) {
$tfFmtResults = terraform fmt -recursive
if ($LASTEXITCODE -ne 0){
@boarnoah
boarnoah / VTOLVRPhysicalInputSettings.xml
Created April 2, 2022 16:41
These are bindings for Saitek X55 Hotas for https://github.com/solidshadow1126/VTOLVRPhysicalInput. Unfortunately the button and axis bindings as reported (by joy.cpl, or sites such as https://gamepad-tester.com/) differ from what DirectX via SharpDX (library used by this mod) understands. These bindings were created by hooking up the mod to a d…
<!--
These are bindings for Saitek X55 Hotas for https://github.com/solidshadow1126/VTOLVRPhysicalInput.
Unfortunately the button and axis bindings as reported (by joy.cpl, or sites such as https://gamepad-tester.com/)
differ from what DirectX via SharpDX (library used by this mod) understands.
These bindings were created by hooking up the mod to a debugger and trial and error.
Please consult the "map" to actual HOTAS keys (as reported by tools such as the config app for the HOTAS) below:
Stick:
Pitch and Roll are bound as expected
@boarnoah
boarnoah / boarnoah.PowerShell_profile.ps1
Last active December 16, 2020 21:11
My personal powershell profile, has a few Powershell cmdlets aliased to a roughly similar linux utility for muscle memory purposes.
# Should be put into powershell's $PROFILE which acts similar to a .bashrc
# ex: notepad $PROFILE
New-Alias which Get-Command
# Get process by port #, ex: "port 8080" -> Find culprit process *cough* random postgres server *cough*
function port {
Get-Process -Id (Get-NetTCPConnection -LocalPort $args[0]).OwningProcess
}
@boarnoah
boarnoah / Add URL to Google Search Results [GreaseMonkey]
Created February 6, 2020 14:28
Adds back green url to google search results
// ==UserScript==
// @name GoogleSearchShowURL
// @description Puts URL under search result in green (YK, like it used to)
// @version 1
// @grant none
// @include https://www.google.com/search*
// @run-at document-end
// ==/UserScript==
@boarnoah
boarnoah / table.vue
Created September 25, 2019 12:17
A wrapper component around a Vuetify data table
<template>
<v-data-table
:items="items"
:headers="itemHeaders"
:multi-sort="true"
:sort-by="sort"
:sort-desc="true"
>
<template v-slot:header.action>
<slot />
import dateutil.parser
from ruletypes import RuleType
# elastalert.util includes useful utility functions
# such as converting from timestamp to datetime obj
from util import ts_to_dt
# Modified version of http://elastalert.readthedocs.io/en/latest/recipes/adding_rules.html#tutorial
# to catch events happening outside a certain time range
@boarnoah
boarnoah / GithubHeaderFixer.js
Created February 11, 2017 01:24
GreaseMonkey / TamperMonkey script to remove Github's Dark Header
// ==UserScript==
// @name GitHubHeaderFixer
// @namespace GitHubHeaderFixer
// @version 1.0
// @description Removes GitHub's Dark Header
// @include https://github.com/*
// @include https://*.github.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
@boarnoah
boarnoah / arma_replay.sqf
Last active December 31, 2016 23:26
SQF script to add replay (controlled with radio options) to review helicopter maneuvers
//Please consult Instructions on usage and setup here: https://www.reddit.com/r/arma/comments/5l6g9n/record_yourself_from_a_different_perspective/dbul78j/
//Code for Zeus GameMaster module's init field:
this addEventHandler ["CuratorObjectPlaced",{
_arg1 = _this select 1;
if(_arg1 isKindOf "Helicopter") then{remoteVehicle = vehicle _arg1};
}];
@boarnoah
boarnoah / ezp.js
Last active June 14, 2016 16:07
angular-elevatezoom-plus useage testing
1) Add ezp in index.html:
- For whatever reason, not including both copies of jquery causes a moduleerr(?)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.js"></script>
<script src='https://cdn.rawgit.com/igorlino/elevatezoom-plus/1.1.18/src/jquery.ez-plus.js'></script>
<script src='https://cdn.rawgit.com/igorlino/angular-elevatezoom-plus/1.1.18b/js/angular-ezplus.js'></script>
1b) Add in ezplus to angular dependecies in app.js:
angular.module('custom', [..., 'ezplus'])...
//INSERT WITH THE OTHER METHODS:
- name: setLoginBehavior
summary: |
Sets the behaviour that the module will attempt to use for authorize().
description: |
Be sure to set this before calling authorize if this is needed. It is
recommended to follow Facebook's [guidelines](https://developers.facebook.com/blog/post/2015/10/29/Facebook-Login-iOS9)
for ideal login behavior
type: Number