Skip to content

Instantly share code, notes, and snippets.

View boppy's full-sized avatar
🕯️

Henning Bopp boppy

🕯️
View GitHub Profile
@boppy
boppy / monsum2json
Last active June 10, 2019 17:19
Results of `monit summary` rendered in json
#!/bin/bash
summary=$(monit summary -B)
numLines=$(wc -l <<< "$summary")
[[ $1 = "-h" ]] \
&& compact=0 \
|| compact=1
awk \
@boppy
boppy / README.md
Created June 10, 2019 16:38
Run a bash script with soft timeout

This little shell boilerplate can be used to run a long running program that has a custom exit state if a timeout is reached. Usefull to monitor by exit state.

The script basically sleeps for the allowed lifetime and touches a file if the parent process is still running. The running process IS NOT INTERUPTED, but after it finished a pre-defined exit state is retuned by the script if timeout was reached.

Config

  • Define exit code in line :4
  • optionally define lifetime in line :7
  • optionally define temp file in line :10
  • Insert long running code and delete lines :30 and :31
@boppy
boppy / monit-and-gmail
Created June 9, 2019 15:37 — forked from jcdarwin/monit-and-gmail
How to allow monit to use gmail as a smtp relay to send out alert emails
# visit https://accounts.google.com/DisplayUnlockCaptcha and click to allow access
# edit /etc/monit/monitrc to include the following
set mailserver smtp.gmail.com port 587
username "whoever@gmail.com" password "whatever"
using tlsv1
with timeout 30 seconds
# run the following to validate access
@boppy
boppy / README.md
Last active November 8, 2019 15:51
Quick'n'dirty mass edit for TYPO3 file list in Chrome

Regarding TYPO3 CMS Feature #60907.

IMPORTANT: Superseded by fabthos Fork.


To manipulate Websites I use this Chrome Extension: User JavaScript and CSS

To have a "edit all"-Button I use the following script on the TYPO3-Domain, with an additional bookmarklet to call _editAllMetaData. It inserts a button in the file table's header or, if not present, it appends it to the search form.

@boppy
boppy / README.md
Last active October 25, 2018 17:03
Simple resolution fake shell script

Synapsis

Emulates screen resolution on some linux. Like: Got some 8K res on my RasPi!

Be sure to enjoy the most beautiful effects on font blurring...

"Installation" note

Ensure to be in your screens native resolution when first using the script since it writes the current resolution into a file (and the current screens name into a second file. Both inside /tmp/ starting with zooom_).

Update a Full MySQL/MariaDB Database to a different Charset and Collation

Don't forget to add username and pwd-prompt if needed (-uroot -p or something...)

Licence?

MIT if I had to name one:

Copyright 2018 Henning Bopp <henning.bopp@gmail.com>
@boppy
boppy / nxpasswd
Last active July 24, 2016 12:58 — forked from ckujau/htpasswd.sh
Generate an .htpasswd file without the Apache tools
#!/bin/bash
#
# Generate an SSHA password for .htpasswd files
#
# Output can be redirected (while asking for password on screen).
# Password has to be entered twice.
#
# * https://www.nginx.com/resources/wiki/community/faq/#how-do-i-generate-an-htpasswd-file-without-having-apache-tools-installed
# * https://nginx.org/en/docs/http/ngx_http_auth_basic_module.html#auth_basic_user_file
#
@boppy
boppy / index.html
Last active June 12, 2016 12:23 — forked from ArunHub/alert-buttons.html
alert the buttons text //source https://jsbin.com/fawepetaha
<div class="btns">
<p>Write JavaScript (using jQuery is fine) so that clicking on any button will cause an alert to popup with the text of the button that was clicked.</p>
<p>Make sure your solution is as efficient as possible even if there are a lot more <code>button.btn</code>'s added on the page. Do not use unnecessary event listeners.</p>
<button class="btn">c</button>
<button class="btn">l</button>
<button class="btn">o</button>
<button class="btn">s</button>
<button class="btn">e</button>
@boppy
boppy / slick-has-n-children.js
Last active January 24, 2016 12:30 — forked from twiss/slick-has-n-children.js
Tries to define :has-n-children([<|>|<=|>=]n)
/* :has-n-children([<|>|<=|>=]n)
* requires Slick
* selects elements with (less/more than (or equal to)) n elements as children
* [2011-07-11] doesn't work yet (tested with 1.1.5)
* [2016-01-24] works now (testet with 1.6); https://jsfiddle.net/ugLaexhc/2/
*/
Slick.definePseudo('has-n-children', function(arg) {
var childrenLen = this.children.length;
var parsedArg = arg.match(/(<|>|<=|>=)?(\d+)/);