A Pen by Massimo Santini on CodePen.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export LANG=en_EN.UTF-8 | |
UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
find . -name \*.java -print0 | tar -T- --null -cf /tmp/${UUID}.tar >/dev/null 2>&1 | |
curl \ | |
--form sessione=1144 \ | |
--form fileToUpload=@/tmp/${UUID}.tar \ | |
https://upload.di.unimi.it/doajaxfileupload.php >/dev/null 2>&1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echocol() { echo -e "\033[32m*** $@...\033[0m"; } | |
echocol "Attempting to download the JDK installer disk image" | |
attempts=5 | |
while ! curl -H "Cookie: oraclelicense=accept-securebackup-cookie" -C - -#LO http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-macosx-x64.dmg; do | |
if [[ $attempts == 0 ]]; then break; fi | |
echo "[restarting an interruped download]" | |
sleep 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, session | |
from flask_sqlalchemy import SQLAlchemy | |
import flask_admin as admin | |
from flask_babelex import Babel | |
from flask_admin.contrib import sqla | |
# Create application | |
app = Flask(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import partial | |
from os import remove | |
from os.path import join | |
from flask import Flask | |
from flask.ext.admin import Admin, form | |
from flask.ext.admin.contrib.sqla import ModelView | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from sqlalchemy.event import listens_for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
t=$1 | |
voci=(Alice Federica Luca Paola) | |
while true; do | |
n=$(($RANDOM%11)) | |
voce="${voci[$(($RANDOM%4))]}" | |
say -v "$voce" "$t per $n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# see http://veithen.github.io/2014/11/16/sigterm-propagation.html | |
trap 'kill -TERM $PID' TERM INT | |
python -m SimpleHTTPServer & PID=$! | |
python -m webbrowser -t "http://127.0.0.1:8000/" | |
wait $PID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:window.location.assign(window.location.href.replace( /javase\/7\//, 'javase/8/' )); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Comparator; | |
import java.util.List; | |
import java.util.stream.Collector; | |
class ArgMaxCollector<T> { | |
private T max = null; | |
private ArrayList<T> argMax = new ArrayList<T>(); |