Skip to content

Instantly share code, notes, and snippets.

@rasmi
rasmi / time_series.sql
Created October 4, 2019 19:50
BigQuery time series aggregation example by Andrew Leach.
# Copyright 2019 Google LLC.
# SPDX-License-Identifier: Apache-2.0
WITH
# Generate a sample time series from the taxi trips dataset.
sample_time_series AS (
SELECT
SUBSTR(taxi_id, 16, 24) AS taxi_id, # Truncate for readability.
trip_start_timestamp,
# Copyright 2019 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@rasmi
rasmi / eva.css
Last active February 20, 2021 01:16
Custom styles for https://evaduns.ky
/*
* WHOLE SITE
*/
/* Slightly purple links. */
.page-content a {
color: #283593 !important;
}
/* Increase space above header on mobile. */
@media (max-width: 767px) {
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@rasmi
rasmi / document_ocr.py
Created November 30, 2018 18:00
Google Cloud Vision API Document OCR
#!/usr/bin/env python
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@rasmi
rasmi / upload_to_bq.sh
Created November 6, 2018 19:52
Upload Vera Incarceration Trends Dataset to BigQuery
#!/bin/sh
# Copyright 2018 Google LLC.
# SPDX-License-Identifier: Apache-2.0
DATA_FILENAME="incarceration_trends.csv"
DATA_URL="https://github.com/vera-institute/incarceration_trends/raw/master/incarceration_trends.csv"
BQ_DATASET_NAME="vera_data"
BQ_DATASET_DESCRIPTION="County-level jail data (1970-2015) and prison data (1983-2015)"
BQ_SCHEMA_FILENAME="schema.json"
BQ_SCHEMA_URL="https://gist.githubusercontent.com/rasmi/b46101a1d20d3da46bafbd77299126c9/raw/c7f12bbdff7adc61e763ff1be22bc21215dc3ff5/schema.json"
@rasmi
rasmi / schema.json
Created November 6, 2018 17:57
Incarceration Trends BigQuery Schema
[
{
"name": "yfips",
"type": "INT64",
"mode": "REQUIRED",
"description": "Unique ID: Year and FIPS code"
},
{
"name": "year",
"type": "INT64",
@rasmi
rasmi / setup.md
Last active November 1, 2023 15:46
Python development environment setup on Chromebook

Python development environment setup on Chromebook

Check for updates

Do this first!

sudo apt-get update && sudo apt-get dist-upgrade

Set root password

@rasmi
rasmi / styles.css
Created December 10, 2016 18:31
Google Docs Minimal
/* Hide page break line */
.kix-page-compact::before {
border-style: none;
}
/* Hide Explore icon */
.docs-explore-widget {
display: none;
}
@rasmi
rasmi / facebook-mass-delete-group-members.js
Last active December 9, 2016 06:28 — forked from michaelv/facebook-mass-delete-group-members.js
This javascript removes all users from a facebook group. It works with the new facebook layout. Paste this in the javascript console. Script tested in Firefox. Known issues: 1. when facebook responds slowly, the script might experience hickups.. 2. occasionially, the error 'this user is not a member of the group' pops up.. IMPORTANT: add your ow…
var deleteAllGroupMembers = (function () {
var deleteAllGroupMembers = {};
// the facebook ids of the users that will not be removed.
// IMPORTANT: add your own facebook id here so that the script will not remove yourself!
var excludedFbIds = ['1150288216']; // make sure each id is a string!
var usersToDeleteQueue = [];
var scriptEnabled = false;
var processing = false;
deleteAllGroupMembers.start = function() {