Skip to content

Instantly share code, notes, and snippets.

View esolitos's full-sized avatar

Marlon (Esolitos) Saglia esolitos

View GitHub Profile
@esolitos
esolitos / get-docker-command.sh
Created June 1, 2023 11:27
Small script to get the docker command from a running container.
#!/bin/bash
# Get container name from the first script parameter
CONTAINER_NAME=$1
# Get the image name
IMAGE=$(docker inspect $CONTAINER_NAME | jq -r .[0].Config.Image)
# Get the environment variables
ENV_VARS=$(docker inspect $CONTAINER_NAME | jq -r '.[0].Config.Env[]' | sed 's/^/-e /' | tr '\n' ' ')
# Schema for the views plugins.
views.filter.project_size_range_select:
type: views_filter
label: 'Foobar numeric'
views.filter_value.project_size_range_select:
type: views.filter_value.numeric
label: 'Foobar Numeric'
@esolitos
esolitos / 0.DRCMD.README.md
Last active May 4, 2022 14:27
Drush command "executor" on alias pattern. Built for Wodby aliases naming standard, but can work on other setups.

DrCmd - DrushComander

drush command runner for Wodby aliases

0. Install

Save the file in /usr/local/bin/ (or anywhere else as long as it is in your $PATH) and verify that it is executable.

a. Right click on "Raw" button (for drcmd) and copy the URL.

(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 / padlet-download.js
Created November 19, 2021 10:55
Download all images from padlet.com without clicking each one
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
#
# 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 / OUTDATED # Drupal + RamsaltMedia Settings
Last active February 19, 2020 13:46
OUTDATED # Devel settings for Drupal + RamsaltMedia platforms - MOVED to https://github.com/esolitos/drupal-utility
This config assumes that:
- `platform.settings.php` is placed in the `sites/` directory
- you have a `sites/files` directory in your drupal installation.
- you have a `ramsalt` user that can access all your databases starting with `ramsalt_`
- the files on the "live" site are placed in the drupal's default directory: `sites/hostname.tld/files`
@esolitos
esolitos / aliases.zsh
Last active January 22, 2020 11:28
Aliases (WIP)
#!/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.
#!/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
@esolitos
esolitos / Readme.md
Last active October 17, 2019 14:17
Simple drupal module for drush scripts to re-save all the ndoes

This module simply loads and saves the nodes, it increases by 1 second the creation date and by only 5 the "last updated" on nodes.

Version: 1.3