This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import time | |
import pprint | |
pp = pprint.PrettyPrinter(indent=4) | |
import requests | |
import json | |
from datetime import datetime | |
DEV_FORCE_BOOKING = False |
This file contains 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 os | |
from datetime import datetime, timedelta | |
dropbox_screenshot_dir = '/Users/adrienshen/Dropbox/Screenshots' | |
defaults = { | |
'days_since': 30, | |
} | |
oldest_date = datetime.now() - timedelta(defaults['days_since']) | |
def browse_files(): |
This file contains 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
const ytdl = require('ytdl-core'); | |
const express = require('express'); | |
const app = express(); | |
const videoID = 'http://www.youtube.com/watch?v='; | |
app.use('mp3', express.static(__dirname + '/mp3')); | |
app.get('/stream/:id', (req, res) => { | |
console.log('video url >> ', videoID + req.params.id); |
This file contains 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
-- search vectors column and create index | |
alter table movie_scripts add "document_vectors" tsvector; | |
create index idx_fts_doc_vector on movie_scripts using gin(document_vectors); | |
-- update the search vectors column with script | |
update | |
movie_scripts | |
set | |
document_vectors = (to_tsvector('english', names) || to_tsvector('english', script)); |
This file contains 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
# source and credits: https://www.mikejohnpage.com/blog/web-scraping-r-s-data-table-and-writing-to-postgresql-and-mysql/ | |
library(tidyverse) | |
library(robotstxt) | |
library(data.table) | |
library(rvest) # scraping library | |
library(stringi) | |
library(tidytext) | |
library(RPostgreSQL) |
This file contains 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
''' | |
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. | |
Example 1: | |
11110 | |
11010 | |
11000 | |
00000 |
This file contains 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
{ | |
"arrivalDate": "2016-01-15 05:15:00", | |
"departDate": "2016-01-14 22:00:00", | |
"origin": "Gombak", | |
"destination": "Jerteh", | |
"pickUpPoints": [ | |
{ | |
"pickupPointName": "Asam Pedas Shell MRR2", | |
"pickupPointId": null, | |
"departureTime": "2016-01-14 22:00:00", |
This file contains 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
{ | |
"arrivalDate": "2016-01-15 05:15:00", | |
"departDate": "2016-01-14 22:00:00", | |
"origin": "Gombak", | |
"destination": "Jerteh", | |
"pickUpPoints": [ | |
{ | |
"pickupPointName": "Asam Pedas Shell MRR2", | |
"pickupPointId": null, | |
"departureTime": "2016-01-14 22:00:00", |