Skip to content

Instantly share code, notes, and snippets.

View janosroden's full-sized avatar

Janos Roden janosroden

View GitHub Profile
@janosroden
janosroden / commit.sh
Last active October 20, 2023 14:25
These scripts help you to keep any customization in a separated branch. Useful if commit of project files are forbidden.
# What is this:
# Call this script when you want to commit customization changes
# from your customized repo.
#
# How it works:
# Creates a new temp git worktree for the customization branch
# and updates the tracked files with your local changes.
# Output of `git diff` used for patches.
# Deleted files are deleted, but you have to add new files manually.
# After copy, it calls $EDITOR <temp dir> and wait until you close.
srcJson = """
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
> flutter packages pub run build_runner build --verbose --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took 514ms
[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Reading cached asset graph...
[INFO] BuildDefinition:Reading cached asset graph completed, took 99ms
[INFO] BuildDefinition:Checking for updates since last build...
[INFO] BuildDefinition:Checking for updates since last build completed, took 752ms
@janosroden
janosroden / cronjob.yaml
Last active March 11, 2019 17:47
Example solution (not copy-paste ready) to stop sidecar containers in a job (https://github.com/kubernetes/kubernetes/issues/25908)
apiVersion: batch/v1beta1
kind: CronJob
spec:
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
containers:
- name: &jobContainer job
@janosroden
janosroden / flushdns.sh
Created May 9, 2018 12:42
Flush DNS cache on OSX High Sierra
sudo killall -HUP mDNSResponder
sudo killall mDNSResponderHelper
sudo dscacheutil -flushcache
#!/bin/bash
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:"
if ping -c3 ilo.blacksalt.cloud | grep -q "3 packets transmitted, 0 received"; then
poff myvpn > /dev/null || true
pon myvpn
fi
@janosroden
janosroden / 00_pv_recycle.sh
Last active May 14, 2018 19:12
The script polls the list of persistent volumes and if finds an unused one then recreates it with the same size but different name on nfs.
#!/usr/bin/bash
export PATH=/usr/local/bin:/usr/bin
[[ -f /var/run/pv.lock ]] && exit 0
touch /var/run/pv.lock
createPv ()
{
local pvRoot="$1";
-- This query shows a few statistical aspects of a series of numbers
WITH
-- Customization
baseTable AS -- Insert your select here. Define a column called 'numericValue' which will be used in the rest of the queries
(SELECT round((obs_tmst - tmst)*24*60) numericValue FROM apwx_msg A WHERE wx_type = 'METAR/SPECI' AND REGEXP_LIKE(msg_comment, 'M?[0-9]{2}/[M-]?([0-9]{2}|//)')),
groupingBase AS (SELECT 0 groupingBase FROM dual), -- Grouping base is used as a reference value for interval calculations. It can ignore the range of baseTable.
groupInterval AS (SELECT null groupInterval FROM dual) -- Use NULL for automatic group interveral
-- Calculate statistics