Skip to content

Instantly share code, notes, and snippets.

Avatar

Marlon (Esolitos) Saglia esolitos

View GitHub Profile
@esolitos
esolitos / padlet-download.js
Created November 19, 2021 10:55
Download all images from padlet.com without clicking each one
View padlet-download.js
const down = function(img_url, name) {
fetch(img_url)
.then(resp => resp.blob())
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
// the filename you want
a.download = `img-${name}.jpg`
@esolitos
esolitos / oneliners.sh
Created November 11, 2021 14:39
Useful random bash stuff
View oneliners.sh
#
# Drupal 8+: Get installed module versions based on info.yml files
for yml in $(find web/modules/contrib -maxdepth 2 -type f -name '*.info.yml'); do grep -Hi 'version:' "$yml"; done;
#
# Composer: Get all drupal modules in lock file with relative version
jq -c '.packages[] | ({(.name): .version})' < composer.lock | grep --color '"drupal/'
@esolitos
esolitos / aliases.zsh
Last active January 22, 2020 11:28
Aliases (WIP)
View aliases.zsh
#!/bin/zsh
-='cd -'
...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -'
2='cd -2'
3='cd -3'
@esolitos
esolitos / generate-openvpn-client-ip.sh
Created October 28, 2019 09:30
Script to generate static IP for the open vpn clients based on a bind dns zone file.
View generate-openvpn-client-ip.sh
#!/bin/sh
#
# Generates client config files for the server based on DNS zone
#
# Version: 1.0
# Date: 2018-07-21
#
DNS_DOMAIN=mydomain.esolitos.com
DNS_ZONE_FILE=/etc/bind/master/$DNS_DOMAIN
View statusCakeSetAllEULocations.js
// This must be run in the "Bulk edit" _after_ the search for tests has been done.
// Step 1: Manually create _a lot_ of "SET OPTIONS" (just leave them empty)
// MANUAL
// Step 2: Run in JS console: Sets all options to "Test Locations"
jQuery('#options select[name^="o_option_"] option[value="RegionCodes"]').attr('selected', true);
jQuery('#options select[name^="o_option_"]').trigger('change');
// Step 3: Run in JS console: Sets all 1st level options to "Europe"
@esolitos
esolitos / gist:0c6e8d7a8658a48c1c6bd21210af07ca
Created August 12, 2019 12:57
kubectl force pod rotations
View gist:0c6e8d7a8658a48c1c6bd21210af07ca
kubectl get po --all-namespaces --selector=name=varnish -o jsonpath='{range .items[*]}{@.metadata.namespace}{" "}{@.metadata.name}{"\n"}{end}' | xargs -n2 -- sh -c 'kubectl -n $1 delete po $2' sh
View Bitbucket-to-Github.md

(Automatically) Move all repos from Bitbucket to Github

More info here: https://esolitos.com/items/2019/07/automatically-move-my-git-repositories-bitbucket-github

This simple pyhon script is buillt to help mirroring all your repositories from Bitbucket to Github, it is built for python 3.7 using Pipenv, pygithub, and pybitbucket.

If all goes fine you only need to run $ pipenv install, change the following parameters on top of the script and run it: $ pipenv run repository-migrate.py.

 APP_KEYS = {
@esolitos
esolitos / 0. Wodby Upgrade README.md
Last active March 6, 2019 07:34
Upgrade all non Prod instances in Wodby for a given server UUID (Or _all_ if set to `None`)
View 0. Wodby Upgrade README.md

Notes

Currently seems to work only on Python 2.7 due to swagger-codegen using the reserved keyword async.

It also needs a patch on six.py (info here). One must move the second parameter "unicode_escape" from the unicoide() call in six.py:L653 (see on github).

@esolitos
esolitos / SA-CORE-2019-003--8.5.x.patch
Last active February 20, 2019 19:56
SA-CORE-2019-003
View SA-CORE-2019-003--8.5.x.patch
diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php
index 84dd672a93..04fe4a7871 100644
--- a/core/lib/Drupal.php
+++ b/core/lib/Drupal.php
@@ -82,7 +82,7 @@ class Drupal {
/**
* The current system version.
*/
- const VERSION = '8.5.10';
+ const VERSION = '8.5.11';
@esolitos
esolitos / Drupal8Placeholders.md
Created August 30, 2018 19:42
Placeholder strategies in Drupal 8
View Drupal8Placeholders.md