Skip to content

Instantly share code, notes, and snippets.

View tags.sql
---- Query 1: query all dataset and write presence of tags into temp table `tags_counts`
CAST(REGEXP_CONTAINS(body, r'(?i)<div\s[^>]*\s*onclick\s*=\s*') AS INT64) tag_div,
CAST(REGEXP_CONTAINS(body, r'(?i)<a\s[^>]*\s*onclick\s*=\s*') AS INT64) tag_a,
CAST(REGEXP_CONTAINS(body, r'(?i)<button\s') AS INT64) tag_button,
CAST(REGEXP_CONTAINS(body, r'(?i)<input\s[^>]*\s*type\s*=\s*[\'"]button[\'"]') AS INT64) tag_input
WHERE page = url
pif /
Created Feb 22, 2018
This one-liner let's you securely check your password against @troyhunt's DB of 500M pwned passwords.
# @troyhunt collected 500M passwords in "Pwned Passwords v2" DB.
# This is the one-liner for checking your password against that DB with the support of k-Anonymity.
# k-Anonymity means his website won't know the password you check.
# Read more about the DB & k-Anonymity in this blogpost:
# Usage:
# 1. Execute in bash/zsh.
# 2. Enter your password.
# 3. If it outputs nothing -- your password didn't appear in the DB.
# Otherwise it will show how many times that password appeared in the breaches.
View webcrawler.go
//////////// Exercise Web Crawler / Golang
package main
import (
type Fetcher interface {
// Fetch returns the body of URL and
pif / gist:c59a9cae30983b6e7bc5
Created Mar 25, 2015
Move all Dropbox Camera Uploads files to separate folders. New folder format is YYYY_MM_DD. E.g.: 2015_01_22
View gist:c59a9cae30983b6e7bc5
~/D/Camera Uploads ❯❯❯ IFS=$'\n'; for f in $(ls | cat)
folder=$(echo $f | sed "s/\(\) \([0-9][0-9]\.[0-9][0-9]\.[0-9][0-9].*\)/\1/g" | sed "s/-/_/g")
echo "Moving $f to $folder"
mv $f ~/BACKUP/$folder
pif /
Last active Dec 27, 2015
Google Glass gestures support for your APK
package com.example.utils;
import android.content.Context;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.widget.Toast;
public class GlassGestures implements GestureDetector.OnGestureListener {
pif /
Created Oct 31, 2013
Add SSL Proxy support for Glass Mirror API Java Sample
* Subscribes to notifications on the user's timeline.
public static Subscription insertSubscription(Credential credential, String callbackUrl,
// Rewrite "" to "" as a workaround for
// http://b/6909300.
callbackUrl = callbackUrl.replace("", "");
// add ssl proxy
callbackUrl = "" + callbackUrl;
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
Part of the Processing project -
Copyright (c) 2004-12 Ben Fry and Casey Reas
Copyright (c) 2001-04 Massachusetts Institute of Technology
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
pif / gist:3899691
Created Oct 16, 2012
get linux/java/flash version
View gist:3899691
uname -a; echo "ISSUE:"; cat /etc/issue; echo "VERSION:"; cat /etc/*version*; echo "RELEASE:"; cat /etc/*release*
java -version; echo "ALTERNATIVES: "; update-alternatives --list java
apt-cache show adobe-flashplugin
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.InputEvent;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Random;
import edu.umd.cs.piccolo.PCanvas;
* To change this template, choose Tools | Templates
* and open the template in the editor.
import java.util.Map;
import java.util.TreeMap;