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
const fs = require('fs'); | |
const process = require('process'); | |
const newman = require('newman'); // require newman in your project | |
// call this as node newman-as-node-module-write-to-disk.js | |
// simpler: How can machine_name and port_number can be passed dynamically to the Postman tests when using Newman? | |
// newman run my-collection.json --global-var "machineName=mymachine1234" --global-var "machinePort=8080" | |
// In your request builder, just use them as normal variables https://{{machineName}}:{{machinePort}}. | |
// call newman.run to pass `options` object and wait for callback |
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
#!/usr/bin/env bash | |
# using gh the commandline tool for github | |
# to filter for all repos with topic awesome-list | |
# and then get the json from gitlab | |
# needs gh, perl and jq installed | |
# gitlab-gh--awesome-lists.sh | |
# knb 2023 |
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 | |
# Purpose: Bulk-delete GitLab pipelines older than a given date | |
# Author: github.com/chrishoerl | |
# GitLab API: v4 | |
# Requirements: jq must be instaled ($ sudo apt install jq) | |
# API example: https://gitlab.example.com/api/v4/projects | |
# API example: https://gitlab.example.com/api/v4/projects/<projectid>/pipelines | |
# | |
# NOTE: Script is just a dryrun. To really delete pipelines, simply uncomment line 49 to activate | |
# |
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
#!/usr/bin/env bash | |
set -Eeu | |
trap 'STATUS=${?}; echo "${0}: Error on line ${LINENO}: ${BASH_COMMAND}"; exit ${STATUS}' ERR | |
trap 'rm -rf ${tempDir}' EXIT | |
readonly supportedUbuntuVersion="22.04" | |
readonly tempDir="/tmp/setup" | |
readonly devDir="${HOME}/dev" | |
readonly scriptsDir="${devDir}/scripts" |
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
#!/usr/bin/env bash | |
# snaps-list-updates-recent.sh | |
# checks all installed snaps by name, | |
# lists them by latest update date. | |
tempfile=/tmp/snaps-$(date +%Y+%m-%d).txt | |
rm -f $tempfile | |
# can take a few seconds to run. | |
# therefore write to temp file. | |
snap_names=$(snap list \ |
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
#!/usr/bin/env bash | |
# HTML::Parser has a convenient option to strip Declarations | |
# by adding a handler. | |
# (from Stackoverflow q 16358962) | |
perl -MHTML::Parser -we ' | |
$p = HTML::Parser->new(default_h => [sub {print @_},"text"] ); | |
$p->handler(declaration => ""); | |
$p->parse_file(shift) or die "Cannot parse: $!"; ' infile.html | |
# HTML::TreeBuilder module is also useful to remove elements and attributes |
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
// ==UserScript== | |
// @name HN Comment Collapse/Expd Button Injector | |
// @version 1 | |
// @grant none | |
// @namespace http://userscripts.org/people/14536 | |
// @description Toggle all comments from collapsed to expanded state | |
// @match https://news.ycombinator.com/* | |
// @author Knut Behrends, ChatGPT | |
// ==/UserScript== | |
(function() { |
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
# benchmarking the new parsnip release 1.0.3 vs previous 1.0.2 | |
# | |
# forked from: @simonpcouch | |
# https://gist.github.com/simonpcouch/651d0ea4d968b455ded8194578dabf52 | |
# gist name:simonpcouch/parsnip_speedup.R | |
# 2022-11-22 | |
# | |
library(tidymodels) | |
# with v1.0.2 ------------------------------------------------------------ |
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
library(ggplot2) | |
# save an image object created with "ggplot2" to svg file | |
# runs on linux | |
myplot_svg <- "myplot.svg" | |
image <- ggplot() + | |
geom_col(aes(x= symb,y=v,fill=symb))+ | |
theme(axis.text.x = element_text(angle=90)) + | |
labs(title='Some title', subtitle=sprintf('%s',date())) + | |
facet_wrap(~ k, scales='free'); |