Skip to content

Instantly share code, notes, and snippets.

View mpneuried's full-sized avatar
Working from home

M. Peter mpneuried

Working from home
View GitHub Profile
mpneuried / postgres_add_json_sub_array_unique.sql
Last active May 6, 2024 13:32
Add and remove elements unique to a Postgres jsonb sub key: Short a Set implemetation
UPDATE public.mytable SET
jsonfieldname = jsonb_set( jsonfieldname, '{json_obj_key}', array_to_json(
SELECT json_array_elements_text( COALESCE( jsonfieldname::json->'json_obj_key', '[]' ) )
) || ARRAY['Element to add'] ) )
)::jsonb )
WHERE id = 23
mpneuried / Makefile
Last active May 4, 2024 13:46
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
mpneuried /
Created March 25, 2013 09:42
Spider all octocats
fs = require( "fs" )
request = require( "request" )
async = require( "async" )
### call this in the octocats list:
list = []
$( "img" ).each ( i, el )->
#console.log arguments
_src = $( @ ).data( "src" )
mpneuried /
Created November 18, 2015 07:01
jQuery: How to post with a json body
_data =
foo: 23
bar: 42
bazz: null
url: _path
type: "POST"
data: JSON.stringify( _data )
contentType: "application/json; charset=utf-8"
mpneuried /
Last active January 19, 2020 08:45 — forked from bzerangue/
A small shell script that will add and remove lines from the hosts file. Originally created by Claus Witt,
#! /bin/sh
# @author: Claus Witt
# Adding or Removing Items to hosts file
# Use -h flag for help
mpneuried /
Last active December 27, 2019 07:20
AWS SQS Message pump

AWS SQS Message pump

This script will pump AWS SQS Messages from one queue into another queue.


./ {profile} {source-sqs-url} {target-sqs-url} [{iterations}]
mpneuried /
Created June 13, 2019 07:29
Script to generate and "publish/copy" a local doc folder to another folder taht could be synced via dropbox/onedrive/google-drive ... it write keep the latest folder and keep archived versions as zip
mpneuried /
Created December 20, 2018 11:19
AWS EC2 Security Groups: Revoke old and add new current ip to a list of rules based ob the description
# This script will update your ec2 security group with the current ip of your connection.
# To find the "old" rules the description is used
# Requirements:
# - aws-cli with configured profile:
# - jq:
# - curl
mpneuried / pow.yaml
Created May 11, 2019 18:27 — forked from frenck/pow.yaml
Sonoff POW R2 Washing Machine Sensor Example
name: pow
platform: ESP8266
board: esp01_1m
board_flash_mode: dout
ssid: 'Demo'
password: 'Livestream'
mpneuried /
Last active July 9, 2018 08:27
bash helpers
# CRON: crontab header to run node and grunt within a cron job