Skip to content

Instantly share code, notes, and snippets.

View ABeltramo's full-sized avatar

ABeltramo

View GitHub Profile
@ABeltramo
ABeltramo / README.md
Last active April 11, 2019 10:31
Solarized Dark - Intellij color scheme

Intellij Solarized Dark color scheme

Example Java interface: screen shot 2019-02-20 at 08 59 07

@ABeltramo
ABeltramo / -etc-squid-squid.conf
Created January 26, 2019 18:23
Squid proxy Raspy
#/etc/squid/squid.conf
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid/passwords
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
# Choose the port you want. Below we set it to default 3128.
http_port 80
@ABeltramo
ABeltramo / README.md
Last active October 30, 2018 08:59
Get business info from Instagram

How to setup?

WORKING ONLY WITH PYTHON VERSION 3.X Copy and paste the following lines in the terminal.

git clone https://github.com/ABeltramo/Instagram-API-python.git
cd Instagram-API-python
pip3 install -r requirements.txt
imageio_download_bin ffmpeg
# Download the script present here
@ABeltramo
ABeltramo / weather.30m.py
Last active September 2, 2019 10:54
BitBar Weather with icons
#!/usr/bin/python
# -*- coding: utf-8 -*-
# <bitbar.title>Weather</bitbar.title>
# <bitbar.version>v3.5.0</bitbar.version>
# <bitbar.author>Daniel Seripap</bitbar.author>
# <bitbar.author.github>seripap</bitbar.author.github>
# <bitbar.desc>Detailed weather plugin powered by DarkSky with auto location lookup. Supports metric and imperial units. Needs API key from https://darksky.net/dev/.</bitbar.desc>
# <bitbar.image>https://cloud.githubusercontent.com/assets/683200/16276583/ff267f36-387c-11e6-9fd0-fc57b459e967.png</bitbar.image>
# <bitbar.dependencies>python</bitbar.dependencies>
\begin{algorithm}
\caption{ConcurrentGain - Le chiamate al calcolo dell'information gain vengono eseguite in parallelo utilizzando tutti i core disponibili.}
\label{alg:ID3_concurrentGain}
\begin{algorithmic}[1]
\Procedure{maxInformationGain}{$Dataset, Attributes, TargetAttributes$}
\Statex Calcola parallelamente l'attributo che meglio suddivide il dataset in input per classificare il target.
\State $Threads \gets $ [ ] \Comment{Creo un array di riferimenti ai Thread}
\ForAll{$Attribute$ in $Attributes$}
\If{$Attribute \not= TargetAttributes$} \Comment{Salto l'attributo Target}
\State $Threads[i] \gets concurrentGain(Attribute)$
@ABeltramo
ABeltramo / test.R
Created December 5, 2017 12:01
Pseudocodice R per il framework
INIT <- function(numeroDiNodi){ # INIT() riceve in input il numero di nodi iniziali del framework
Grafo <- inizializzaGrafo() # Crea il grafo globale iniziale
Matrice <- convertiGrafoInMatrice(Grafo) # Converte il grafo prima generato in una matrice
ListaFinale <- vector(mode="list") # Variabile temporanea: lista di tuple
for (i in 1:numeroDiNodi){ # Per ogni suddivisione della matrice creata
SottoMatrice <- dividiMatrice(Matrice, i , numeroDiNodi) # dividiMatrice spezza la matrice per righe
ListaFinale[i] <- list(input = SottoMatrice, # Creo la tupla [input = SottoMatrice
popolazione = randomPopulation()) # popolazione = popolazione randomica
}
return ListaFinale #
https://www.youtube.com/watch?v=OGr1_qIstlE
https://www.youtube.com/watch?v=U-iAMaqibXU
https://www.youtube.com/watch?v=_qA4p_XWUCA
https://www.youtube.com/watch?v=XI1VpElKWF8
https://www.youtube.com/watch?v=G4UspBs3DGQ
https://www.youtube.com/watch?v=6miaTf1gF4g
https://www.youtube.com/watch?v=AoZhXA10EEI
https://www.youtube.com/watch?v=1m4tYUfYCj4
https://www.youtube.com/watch?v=dv5_QW17xJQ
https://www.youtube.com/watch?v=9aHQnDTd1y4
@ABeltramo
ABeltramo / Test.java
Created January 12, 2017 12:44
Twitter4J Friends
private ArrayList<Long> getAllFriendsIDs(String user) throws TwitterException{
ArrayList<Long> tmp = new ArrayList<>();
ArrayList<Long> friends = new ArrayList<>();
Long cursor = -1L;
IDs ids = null;
checkAPICall("/users/show/:id");
User curUser = _tw.showUser(user);
// Take the min number of user
if(curUser.getFollowersCount() < curUser.getFriendsCount()){
@ABeltramo
ABeltramo / cloudflare.sh
Created December 15, 2016 13:12
Cloudflare iptables
#!/bin/bash
# Only once setup:
# iptables -N cloudflare
# iptables -t filter -I INPUT -j cloudflare -p tcp -m multiport --dports http,https
iptables -F cloudflare
for i in `curl https://www.cloudflare.com/ips-v4`; do
iptables -A cloudflare -p tcp -s $i -m multiport --dports domain,http,https -j ACCEPT;
done
iptables -A cloudflare -j RETURN
@ABeltramo
ABeltramo / Generatore.sh
Last active April 7, 2016 16:51
Correttore olimpiadi
#!/bin/bash
randomResult=0
random ()
{ # Genera un numero random tra due intervalli
lower=$1
upper=$2
randomResult=-99 #initialize
while [ "$randomResult" -le $lower ]
do
randomResult=$RANDOM