Skip to content

Instantly share code, notes, and snippets.

View MaurizioCasciano's full-sized avatar
👨‍💻
Turning Bits ON & OFF

Maurizio Casciano MaurizioCasciano

👨‍💻
Turning Bits ON & OFF
View GitHub Profile
@MaurizioCasciano
MaurizioCasciano / BFSDFS.java
Created May 19, 2017 15:43 — forked from gennad/BFSDFS.java
Breadth-first search and depth-first search Java implementation
Class Main {
public void bfs()
{
// BFS uses Queue data structure
Queue queue = new LinkedList();
queue.add(this.rootNode);
printNode(this.rootNode);
rootNode.visited = true;
while(!queue.isEmpty()) {
Node node = (Node)queue.remove();
# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]
@MaurizioCasciano
MaurizioCasciano / sql-mongo_comparison.md
Created September 26, 2017 06:42 — forked from aponxi/sql-mongo_comparison.md
MongoDb Cheat Sheets

SQL to MongoDB Mapping Chart

SQL to MongoDB Mapping Chart

In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.

Executables

The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.

@MaurizioCasciano
MaurizioCasciano / adfly-skipper.user.js
Created October 25, 2017 09:21 — forked from janglapuk/adfly-skipper.user.js
GreaseMonkey/TamperMonkey script for automating adf.ly 'Skip' button
// ==UserScript==
// @name adf.ly Auto Skip Ad
// @namespace http://github.com/janglapuk
// @version 0.5
// @description Let you ignore the bunch of ads :] (simple and optimized rev)
// @author janglapuk
// @match http://adf.ly/*
// @require http://code.jquery.com/jquery-3.2.1.slim.min.js
// @require https://gist.githubusercontent.com/raw/2625891/waitForKeyElements.js
// @updateURL https://gist.github.com/janglapuk/790470741a39a0f2301b27d234e6a9cc/raw/adfly-skipper.user.js
@MaurizioCasciano
MaurizioCasciano / DoughnutChart.java
Created October 30, 2017 07:23 — forked from jewelsea/DoughnutChart.java
Creating a Doughnut chart in JavaFX
import javafx.collections.ObservableList;
import javafx.geometry.Bounds;
import javafx.scene.Node;
import javafx.scene.chart.PieChart;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
public class DoughnutChart extends PieChart {
private final Circle innerCircle;
@MaurizioCasciano
MaurizioCasciano / postman-deb.sh
Created December 17, 2017 11:55 — forked from SanderTheDragon/postman-deb.sh
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
versionMaj="1"
versionMin="0"
versionRev="1"
version="$versionMaj.$versionMin-$versionRev"
echo "Removing old Postman tarballs"
rm -f $(ls Postman*.tar.gz)
@MaurizioCasciano
MaurizioCasciano / html5-video-play-file-blob.html
Created January 5, 2018 19:37 — forked from edin-m/html5-video-play-file-blob.html
HTML video play file blob object url
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<video></video>
<br/>
<input type="file" name="file" id="fileItem" onchange="onChange()" >
@MaurizioCasciano
MaurizioCasciano / spotihosts
Created February 5, 2018 07:01
The hosts file entries to block Spotify audio ad servers.
127.0.0.1 media-match.com
127.0.0.1 adclick.g.doublecklick.net
127.0.0.1 www.googleadservices.com
127.0.0.1 open.spotify.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 desktop.spotify.com
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 pubads.g.doubleclick.net
127.0.0.1 audio2.spotify.com
127.0.0.1 www.omaze.com
public class AnnotationHelper {
private static final String ANNOTATIONS = "annotations";
public static final String ANNOTATION_DATA = "annotationData";
public static boolean isJDK7OrLower() {
boolean jdk7OrLower = true;
try {
Class.class.getDeclaredField(ANNOTATIONS);
} catch (NoSuchFieldException e) {
//Willfully ignore all exceptions
@MaurizioCasciano
MaurizioCasciano / docker_kill.sh
Created March 22, 2018 07:41 — forked from evanscottgray/docker_kill.sh
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt