Skip to content

Instantly share code, notes, and snippets.

@nom3ad
nom3ad / bookmarklets.md
Created December 28, 2022 16:24 — forked from ElectricRCAircraftGuy/bookmarklets.md
These are bookmarklets (ie: browser bookmarks with Javascript in them) to perform functions to help make your GitHub PR review life easier.
@nom3ad
nom3ad / eols.sh
Created September 2, 2022 08:25 — forked from byroot/eols.sh
Convert the whole git history with dos2unix
git filter-branch --tree-filter 'git ls-files -z | xargs -0 dos2unix' -- --all
@nom3ad
nom3ad / gist:7f3c9716efdc26d66ace809792f60b26
Created June 5, 2022 06:56 — forked from romuald/gist:0346c76cfbbbceb3e4d1
Sub-millisecond profiling for python pstats
# -*- coding: utf8 -*-
"""
A simple monkeypath for the pstats module to be able to see sub-millisecond timings
If display value is 0.000, display the time in microseconds
"""
import pstats
def f8(x):
@nom3ad
nom3ad / rerender.directive.ts
Created May 15, 2022 17:35 — forked from anhkind/rerender.directive.ts
Angular directive to re-render a template if it detects any changes of the input
/**
* Example:
*
* <ng-container *rerender='changingInput'>
* this content will be re-rendered everytime `changingInput` changes
* </ng-container>
*/
import { Directive,
Input,
@nom3ad
nom3ad / aws-iam-poilcy-schema.json
Created January 25, 2022 10:15 — forked from jstewmon/aws-iam-poilcy-schema.json
AWS IAM Policy JSON Schema
{
"type": "object",
"required": ["Statement"],
"additionalProperties": false,
"properties": {
"Version": {
"type": "string",
"enum": ["2008-10-17", "2012-10-17"]
},
"Id": {
@nom3ad
nom3ad / functions.sh
Created December 14, 2021 13:56 — forked from junegunn/functions.sh
Key bindings for git with fzf (https://junegunn.kr/2016/07/fzf-git/)
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
@nom3ad
nom3ad / Jenkinsfile
Created May 10, 2021 04:16 — forked from fedevegili/Jenkinsfile
Idle hours for jenkins ec2 fleet plugin
pipeline {
agent {
label 'jenkins-worker-light'
}
triggers {
cron(env.BRANCH_NAME == 'master' ? '*/15 * * * *' : '')
}
options {
timeout(time: 60, unit: 'SECONDS', activity: false)
}
@nom3ad
nom3ad / ForkMITLicensedProject.md
Created April 30, 2021 07:16 — forked from fbaierl/ForkMITLicensedProject.md
HOWTO fork a MIT licensed project

No, you are not allowed to change the copyright notice. Indeed, the license text states pretty clearly:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

But you are allowed to add a copyright notice.

If you want to keep the MIT license, which is what I would advise you to do, you only need to add a single line to the license file, before or after Copyright (c) 2012 Some Name with your own copyright notice. The final LICENSE file will look like this:

The MIT License (MIT)

@nom3ad
nom3ad / parseJson.groovy
Created April 11, 2021 08:31 — forked from mig82/parseJson.groovy
How to parse json into a serializable HashMap in Jenkins Groovy
@NonCPS
def parseJson(txt){
def lazyMap = new groovy.json.JsonSlurper().parseText(txt)
def map = [:]
for ( prop in lazyMap ) {
map[prop.key] = prop.value
}
return map;
}
@nom3ad
nom3ad / Jenkinsfile.groovy
Created April 9, 2021 16:35 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"