Skip to content

Instantly share code, notes, and snippets.

View fradaloisio's full-sized avatar

Francesco d'Aloisio fradaloisio

View GitHub Profile
#!/bin/bash
BASE_GIT_DIR="$HOME/git"
GIT_REPO=$1
GIT_DIR=$(echo ${GIT_REPO} | awk -F":" -v BASE_GIT_DIR="$BASE_GIT_DIR" '{print BASE_GIT_DIR"/"$2}' | xargs dirname)
mkdir -p ${GIT_DIR}
if [ $? == 0 ]; then
echo "Using folder ${GIT_DIR}"
git -C ${GIT_DIR} clone --recurse-submodules ${GIT_REPO}
fi
# Example docker env file for OWS instance with (a single file) configuration.
# Set some default vars, you can overwrite these by creating env vars
AWS_NO_SIGN_REQUEST=true
AWS_DEFAULT_REGION=us-west-2
AWS_REGION=us-west-2
DB_HOSTNAME=postgres
DB_PORT=5432
DB_USERNAME=opendatacubeusername
DB_PASSWORD=opendatacubepassword
DB_DATABASE=opendatacube
docker build -t myapp:latest myapp/
docker save --output myapp_latest.tar myapp:latest
sudo k3s ctr images import myapp_latest.tar
@fradaloisio
fradaloisio / Dockerfile
Last active September 6, 2021 08:58
Docker image with ssh daemon enabled
FROM almalinux:8
ARG SSH_PRIVATE_KEY
RUN mkdir ~/.ssh/
RUN echo "${SSH_PRIVATE_KEY}" > ~/.ssh/authorized_keys
RUN chmod 400 ~/.ssh/authorized_keys
RUN yum -y install openssh-server openssh-clients iproute python39;
RUN /usr/bin/ssh-keygen -A
RUN chpasswd <<<"root:root"
EXPOSE 22
CMD ["/usr/sbin/sshd","-D"]
args = "-c" & " -l " & """cd ;export DISPLAY=127.0.0.1:0.0 ;terminator"""
WScript.CreateObject("Shell.Application").ShellExecute "bash", args, "~", "open", 0
from gps3 import agps3
import time
import dateutil.parser as dp
import requests
#host = '192.168.1.15'
host = '127.0.0.1'
s = 30
traccar_server = "https://XXXXXXX/traccar/"
traccar_id_device = 11111
#name and ip
docker inspect CONTAINTERID | jq '{Name:.[].Name,ip:.[].NetworkSettings.Networks[].IPAddress}'
[vagrant@localhost ~]$ FILE="/this/is/the/file.ext"
# dirname
[vagrant@localhost ~]$ echo "${FILE%/*}"
/this/is/the
#basename
echo "${FILE##*/}"
file.ext
# Full path whitout extension
[vagrant@localhost ~]$ echo "${FILE%.*}"
/this/is/the/file
@fradaloisio
fradaloisio / sds011.py
Last active November 1, 2017 11:32 — forked from geoffwatts/sds011.py
Read an SDS011 Laser PM2.5 Sensor (Nova PM Sensor) with Python
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import serial, time, struct
ser = serial.Serial()
ser.port = "/dev/ttyUSB0" # Set this to your serial port
ser.baudrate = 9600
ser.open()
@fradaloisio
fradaloisio / index.html
Created October 10, 2017 22:31 — forked from anonymous/index.html
Ticking Clock
<div id="clock"></div>
<div id="utc"></div>
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">