Skip to content

Instantly share code, notes, and snippets.

View lidio601's full-sized avatar

Fabio Cigliano lidio601

View GitHub Profile
@lidio601
lidio601 / input.xml
Last active December 12, 2022 14:51
Python script to parse an XML to a CSV File
<?xml version="1.0" encoding="UTF-8"?>
<dataroot>
<torrent data="ciao">
<id>8133976</id>
<title>lool</title>
<magnet>fce1f6eee4c669c4ff81d89595194cbe7d6f6eb5</magnet>
</torrent>
<torrent>
<id>8133975</id>
<title>Car.SOS.S01E01.HDTV.XviD-AFG</title>
@lidio601
lidio601 / run.sh
Created July 8, 2014 20:22
Linux: send command from another terminal to a TTY terminal
#!/bin/bash
# see http://askubuntu.com/questions/194293/how-to-send-terminal-command-to-a-tty-terminal
nano ttyecho.c
make ttyecho
sudo chown root:root ttyecho
sudo chmod u+s ttyecho
@lidio601
lidio601 / bitbucket_crawler.py
Created June 26, 2014 09:59
A JSON-crawler that downloads the list of public repositories of a specific username into a JSON output file
# https://docs.python.org/2/library/httplib.html
import httplib, urllib
# http://stackoverflow.com/questions/237079/how-to-get-file-creation-modification-date-times-in-python
import sys, os, time
# http://stackoverflow.com/questions/17043860/python-dump-dict-to-json-file
import json
/* eslint-disable no-console */
import _ from "lodash";
const DEBUG = !process.env.NODE_ENV || process.env.NODE_ENV === "development";
class ConfigHolder {
constructor(initialValue) {
this.value = initialValue;
}
@lidio601
lidio601 / nginx_ssl_proxy.conf
Created October 14, 2016 07:10
Nginx SSL Proxy configuration to bridge with
#
# Nginx SSL Proxy
# @link https://gist.github.com/lidio601/aa97397f8cdb5f405ce770dde2fe3c2b
# @link https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-with-ssl-as-a-reverse-proxy-for-jenkins
#
# Redirect all HTTP requests to SSL
server {
@lidio601
lidio601 / mac_vendors.dart
Last active March 2, 2020 05:48
API integration for macvendors.com API
///
/// Wrapper around Macvendors API
/// https://macvendors.com/api
///
import 'package:http/http.dart' as http;
import "zmac_address.dart";
const BASE_URL = "https://api.macvendors.com";
@lidio601
lidio601 / mac_address.dart
Created March 2, 2020 05:47
simple function to normalize mac addresses
final d = "([0-9A-F]{2})";
final s = "[:\.-]?";
final RegExp re = RegExp(
"$d$s$d$s$d$s$d$s$d$s$d",
multiLine: false,
);
/// MAC addresses will come in the following shape or form:
@lidio601
lidio601 / loadScript.js
Last active January 18, 2020 19:34
Load custom script into DOM (with Promise)
/**
* Dinamically load script into DOM
* @see https://gist.github.com/lidio601/81974ecf4564dbf257f80a969dcbdd5c
*
* Example usage:
* {code}
require('./loadScript');
console.log('starting');
@lidio601
lidio601 / block-signup.md
Created January 14, 2020 05:04
Google Cloud function to automatically disable new users

Firebase Authentication

Via this Cloud Function you can automatically disable new users.

To deploy this, replace with yours and deploy via command line with:

gcloud functions deploy block-signup --runtime nodejs10 --trigger-event providers/firebase.auth/eventTypes/user.create --trigger-resource <PROJECT-ID>
@lidio601
lidio601 / bluetooth_sendsms.py
Created July 2, 2014 14:59
Python test to send SMS to a phone via Bluetooth
import bluetooth
#import serial
sockfd = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
# sockfd.connect(('00:15:2A:D1:F4:8A', 1)) # BT Address
sockfd.connect(('00:1B:EE:35:0A:B1', 1)) # BT Address
sockfd.send('ATZ\r')
sockfd.send('AT+CMGF=1\r')
sockfd.send('AT+CMGS="+390111001101"\r') # TO PhoneNumber