Skip to content

Instantly share code, notes, and snippets.

View lorello's full-sized avatar
🏠
Working from home

LoreLLo lorello

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am lorello on github.
  • I am lorello (https://keybase.io/lorello) on keybase.
  • I have a public key whose fingerprint is 3A46 1358 838A 8100 F5AE AC79 1D71 C87F E705 70C9

To claim this, I am signing this object:

@lorello
lorello / -parse-server-dockerized
Last active February 8, 2019 18:21
ParseServer setup with official docker images and HTTPS
Enjoy a local environment of ParsePlatform
www.parseplatform.org
@lorello
lorello / get_github_team_keys
Created April 5, 2019 13:13
Add the ssh public keys of a github team to a local user
#!/bin/bash
#
# Enable an ops team defined in github to connect to a server using ssh keys
#
# Requirements:
#
# - jq
# - httpie
#
# On debian based:
@lorello
lorello / docker-compose-installer.sh
Created November 8, 2019 14:44
Latest version of docker-compose Installer
#!/usr/bin/env bash
set -ex
if [[ ! -f /usr/local/bin/docker-compose ]]; then
sudo apt install -y curl
curl -s https://api.github.com/repos/docker/compose/releases/latest \
| grep browser_download_url \
| grep docker-compose-Linux-x86_64 \
| cut -d '"' -f 4 \
@lorello
lorello / log.sh
Created November 26, 2019 08:35
Simple Log function in Bash
# a simple log function in bash
# usage:
# log "my info message"
# log "my debug message" debug
log_level=info
# uncomment next line to rise up log level
#log_level=debug
log() {
@lorello
lorello / ec2-custom-name.sh
Last active February 9, 2020 14:11
Customize EC2 hostname
#!/usr/bin/env bash
# set hostname to current name with the last 4 chars of instance id
#
id=$(ec2metadata --instance-id)
myname=${HOSTNAME}-${id:(-4)}
hostnamectl set-hostname $myname
sed -i "s/${HOSTNAME}/${myname}/g" /etc/hosts
echo "New hostname is $myname"
@lorello
lorello / cron-utils-setup.sh
Created December 12, 2019 13:34
run-one: cron utilities from Ubuntu not available on other distros
#!/bin/bash
source_file="https://bazaar.launchpad.net/~run-one/run-one/trunk/download/head:/runone-20110124065624-91p2i9nu34o1aq4k-2/run-one"
other_commands="keep-one-running
run-one-constantly
run-one-until-failure
run-one-until-success
run-this-one"
bin_path=${INSTALL_PATH:-/usr/local/bin}
@lorello
lorello / Dockerfile
Created January 20, 2020 23:15
Container with cron-like scheduling and healthcheck
FROM alpine
RUN set -x \
&& apk update && apk add ca-certificates curl \
&& curl -L https://github.com/odise/go-cron/releases/download/v0.0.7/go-cron-linux.gz | zcat > /usr/local/bin/go-cron \
&& chmod a+x /usr/local/bin/go-cron \
&& apk del ca-certificates
ENV SCHEDULE '@daily'
ENV HEALTHCHECK_PORT 8080
@lorello
lorello / Dockerfile
Last active February 19, 2020 21:04
Manage private composer repos during docker build
FROM php:7.2.26-fpm-stretch
# Fixed version with OS Debian strech for the issue here explained
# https://github.com/docker-library/php/issues/865
# Set defaults for variables used by run.sh
ENV COMPOSER_HOME=/root/.composer
# Create Composer directory (cache and auth files) & Get Composer
RUN mkdir -p $COMPOSER_HOME \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
@lorello
lorello / api.md
Created March 18, 2020 10:05
Api snip

GET /devices List device classes POST /devices/create Create a new device class GET /devices/{id} Inspect a device class POST /devices/{id}/update Update a device class DELETE /devices/{id} Delete a device class