Skip to content

Instantly share code, notes, and snippets.

Avatar

Francesco d'Aloisio fradaloisio

View GitHub Profile
View startTerminator.vbs
args = "-c" & " -l " & """cd ;export DISPLAY=127.0.0.1:0.0 ;terminator"""
WScript.CreateObject("Shell.Application").ShellExecute "bash", args, "~", "open", 0
View rpi_to_traccar.py
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
View Docker and jq
#name and ip
docker inspect CONTAINTERID | jq '{Name:.[].Name,ip:.[].NetworkSettings.Networks[].IPAddress}'
View path and file
[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 Nov 1, 2017 — forked from geoffwatts/sds011.py
Read an SDS011 Laser PM2.5 Sensor (Nova PM Sensor) with Python
View sds011.py
#!/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()
View index.html
<div id="clock"></div>
<div id="utc"></div>
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
View apache_bosun.conf
## BOSUN
RewriteRule /alerting/static/js/bosun.js /var/www/html/my-static/js/bosun.js [L]
<Location /alerting>
AddOutputFilterByType SUBSTITUTE text/html text/plain text/xml text/css text/javascript application/javascript application/json
Substitute "s#href=\"/#href=\"/alerting/#ni"
Substitute "s#ng-href=\"/#ng-href=\"/alerting/#ni"
Substitute "s#src=\"/#src=\"/alerting/#ni"
Substitute "s#data-path=\"/#data-path=\"/alerting/#ni"
Substitute "s#MYHOST/#MYHOST/alerting/#ni"
View bosun.js
/// <reference path="angular.d.ts" />
/// <reference path="angular-route.d.ts" />
/// <reference path="angular-sanitize.d.ts" />
/// <reference path="bootstrap.d.ts" />
/// <reference path="moment.d.ts" />
/// <reference path="moment-duration-format.d.ts" />
/// <reference path="d3.d.ts" />
/// <reference path="underscore.d.ts" />
var bosunApp = angular.module('bosunApp', [
'ngRoute',
View test_api.py
from flask import Flask
from flask import jsonify
app = Flask(__name__)
@app.route("/")
def hello():
return jsonify({'message' : 'Hello!'})
@app.route("/date")
def getDate():
import datetime
View Windows Vagrant fix
echo 'config.vm.synced_folder ".", "/vagrant", type: "virtualbox"' >> Vagrantfile
vagrant plugin install vagrant-vbguest
vagrant destroy && vagrant up