Skip to content

Instantly share code, notes, and snippets.

View gionn's full-sized avatar
⚔️

Giovanni Toraldo gionn

⚔️
View GitHub Profile
@gionn
gionn / crs_download.py
Last active October 18, 2020 07:44
J.CRS - Centro Regionale Sangue - Script per scaricamento dati automatico
import requests
import time
# J.CRS Credentials
username = ''
password = ''
# Export interval
date_from = '01-09-2020'
date_to = '17-10-2020'
# Downloaded file name: {association_id}{location_id}.zip
@gionn
gionn / snapshot.sh
Last active September 3, 2020 06:57
Grab snapshot (single frame) from RTSP ipcam and publish to S3
#!/bin/bash -e
# Move inside a tmpfs directory
cd /dev/shm
# Grab a snapshot of the RTSP source and save on current folder
# rtsp_transport tcp to avoid packet loss (truncated image)
# qscale:v to adjust jpeg quality (2 is best, 31 worst)
ffmpeg -loglevel panic -y -rtsp_transport tcp -i rtsp://192.168.199.91 -vframes 1 -qscale:v 4 snapshot.jpg
@gionn
gionn / dynatrace-soft-restart.rb
Created April 10, 2020 08:53
Chef recipe to automatically restart docker containers or generic services affected by an update of dynatrace agent
ruby_block "check-restart-dynatrace" do
block do
headers = {:Authorization => "Api-Token #{provider['api_key']}"}
client = Chef::HTTP.new(provider['url'])
processes = JSON.parse(client.get('/processes?includeDetails=true', headers))
hosts = JSON.parse(client.get('/hosts?includeDetails=true', headers))
host_found = hosts.select { |host| host['discoveredName'] == node['hostname'] }.first
if host_found
host_id = host_found['entityId']
processes.select { |process| process['fromRelationships']['isProcessOf'].include?(host_id) }
@gionn
gionn / import.sh
Created June 27, 2012 09:00
Migration script from Windows DNS to PowerDNS
#!/bin/bash
DOMAINARRAY=`cat /mnt/samba/winnt/system32/dns/domainlist`
for domainname in $DOMAINARRAY
do
echo " "
echo "$domainname being imported"
zone2sql --zone=$domainname.dns --gmysql --zone-name=$domainname | mysql -h
10.10.1.1 -D pdns -u pdns
echo "$domainname done!"
@gionn
gionn / pfdel.perl
Created July 10, 2012 15:29
pfdel - deletes message containing specified address from Postfix queue. Matches either sender or recipient address.
#!/usr/bin/perl -w
#
# pfdel - deletes message containing specified address from
# Postfix queue. Matches either sender or recipient address.
#
# Usage: pfdel <email_address>
#
use strict;
@gionn
gionn / gist:4739763
Last active May 21, 2019 21:27
Zimbra: automatic fetching of external accounts.

Zimbra automatic fetching of external accounts

Zimbra 8 will not fetch automatically external POP3 or IMAP account. Use the following command to enable it! (every 5 minutes)

zmprov mc default zimbraDataSourcePollingInterval 5m

@gionn
gionn / tf_ssh_config_gen.rb
Last active December 18, 2018 17:34
Quick script to generate an ssh_config after a terraform apply on OpenStack, GCE, DigitalOcean
#!/usr/bin/env ruby
# NOTICE: GCE and OpenStack providers only.
require 'json'
require 'erb'
def get_template()
%{
<% hosts.each do |key, entry| %>
Host <%= key %>
@gionn
gionn / huwei-p8-lite-slow-wifi.md
Last active November 12, 2018 03:15
huawei p8 lite how to fix slow wifi issue

How to fix slow wifi issue on Huawei P8 Lite

I have a TP-Link TD-W8980 v1 router, two Huawei P8 Lite devices and another bunch of devices working pretty well.

I was testing on https://fast.com, both p8 remain like 10 seconds on the page with 0 Kbps speed, and then reach awful speed (below 1 MB).

Turning bluetooth off fixed the issue, but after renabling it is still working.

@gionn
gionn / TATE.md
Last active April 1, 2018 18:36
Root and install cyanogenmod on Kindle Fire HD (2nd generation) codename tate
@gionn
gionn / wireless
Last active February 18, 2018 20:03
Increase wifi speed on Gargoyle router (TP-Link TL-WR1043N/ND v1)
root@router:~# cat /etc/config/wireless
config wifi-device 'radio0'
option type 'mac80211'
option hwmode '11g'
option path 'platform/qca955x_wmac'
option htmode 'HT40-'
option noscan '1'
option channel '7'