Skip to content

Instantly share code, notes, and snippets.

View moregeek's full-sized avatar

Stefan Morgenthaler moregeek

View GitHub Profile
@moregeek
moregeek / serverless-plugin-json.js
Created December 23, 2023 19:57
Serverless Plugin that stringify's a JSON input
'use strict';
class ServerlessPluginJSON {
constructor() {
this.configurationVariablesSources = {
jsonStringify: {
async resolve({ params }) {
return {
value: JSON.stringify( (params[0] || {}) ),
};
#!/usr/bin/env bash
#
# GPLv3 / Stefan Morgenthaler, 2015;
#
# What?
#
# traverses a given directory down till no subdirectories are present. The pdf
# files within the 'last' directory are merged together and stored in the
# parents folder. The merged document uses the name of the directory, the pdfs
# where located in.
@moregeek
moregeek / cd
Last active December 18, 2015 08:42
extends "cd" to accept (multiple) "dots" as indicator to traverse the directory tree up
#
# Copyright (C) 2015 Stefan Morgenthaler
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@moregeek
moregeek / CloneTest.coffee
Last active August 29, 2015 14:06
CoffeeScript Class Example for "private" variables
class CloneTest
constructor: (options = {}) ->
@default_options = {
foo: false, bar: false, baz: false
}
$.extend(@default_options, options)
getValues: ->
@moregeek
moregeek / collection_of_personal_dev_rules.md
Created June 5, 2014 10:46
Personal List of Rules for Development (in progress)

Web Development

  • No inline JavaScript within HTML
require 'cgi'
require 'digest/md5'
require 'net/https'
require 'uri'
module Jekyll
class GistTag < Liquid::Tag
def initialize(tag_name, text, token)
super
@text = text
\ProvidesFile{absender.lco}
\KOMAoptions{%
% fromemail=true, % Email wird im Briefkopf angezeigt
% fromphone=true, % Telefonnumer wird im Briefkopf angezeigt
% fromfax=true, % Faxnummer wird im Briefkopf angezeit
% fromurl=true, % URL wird im Briefkopf angezeigt
% fromlogo=true, % Logo wird im Briefkopf angezeigt
% subject=titled, % Druckt "Betrifft: " vor dem Betreff
locfield=wide, % Breite Absenderergänzung (location)
@moregeek
moregeek / edis_pi_online_stats.sh
Last active December 31, 2015 16:29
Check Edis RPi Colocation Range for online/offline RPi's (if FW blocks ICMP => offline)
#!/usr/bin/env bash
# q&d; WTFPL;
count_off=0;
count_onl=0;
for n in {1..254}; do
ip="151.236.12.${n}";
ping -c1 -t1 ${ip} > /dev/null 2>&1
@moregeek
moregeek / ferm.conf
Created November 26, 2013 08:35
Portknocking with ferm example
domain (ip) {
table filter {
#
# Subchains: Portknocking
# ################################################################################
chain PORT_KNOCKING_1 {
protocol tcp {
mod recent name "port_knock_seq_01" set NOP;
}
@moregeek
moregeek / README
Last active December 29, 2015 02:18
## INSTALL
curl -o ~/bin/knockp https://gist.github.com/moregeek/7599055/raw/knockp
chmod +x ~/bin/knockp
## USAGE
### With ssh config (~/.ssh/config)
host example.org
ProxyCommand sh -c "~/bin/knockp -s example.org 2000 3000 4000; nc %h %p"