Skip to content

Instantly share code, notes, and snippets.

@dotkwame
dotkwame / gsutil_cron_example.sh
Created September 15, 2022 17:28 — forked from nazroll/gsutil_cron_example.sh
A shell script example to run "gsutil" as a cronjob
#! /bin/bash
# Replace "/path/to/gsutil/" with the path of your gsutil installation.
PATH="$PATH":/path/to/gsutil/
# Replace "/home/username/" with the path of your home directory in Linux/Mac.
# The ".boto" file contains the settings that helps you connect to Google Cloud Storage.
export BOTO_CONFIG="/home/username/.boto"
# A simple gsutil command that returns a list of files/folders in your bucket.
@dotkwame
dotkwame / database.rules.json
Created November 4, 2020 23:45 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@dotkwame
dotkwame / gist:0ec0ee242d70d4a7f996010e0f8f8d16
Created August 2, 2017 07:51
Node, Request, Cheerio and Firebase multi-site/multi-page scraper snippet.
var request = require('request'), client = request.defaults({forever: true}), cheerio = require('cheerio'), Firebase = require('firebase'), uuid = require('node-uuid');
console.log("Started: " + new Date());
var start = new Date().getTime(), sV = [], iL = 0, totalJobs = 0, totalSites = 0, newJobs = 0, datatoCompare = [], datatoSet = [], multiStorage = [];
console.log("\nGathering Data...\n");
var ref = new Firebase("https://null.firebaseio.com"), lRef, cRef;
ref.authWithPassword({
email: '',
password: ''
}, function() {
lRef = ref.child("/listings");
@dotkwame
dotkwame / LinkFixerClone.py
Created June 3, 2017 06:04 — forked from dmarx/LinkFixerClone.py
A simple LinkFixerBot clone developed as a demonstration for anyone who is curious how a simple reddit bot might be coded. To kill this code, spam "Ctrl+C" until it catches the exception.
import praw # simple interface to the reddit API, also handles rate limiting of requests
import re
from collections import deque
from time import sleep
USERNAME = "Your username here"
PASSWORD = "Your password here"
USERAGENT = "Your useragent string here. It should include your /u/username as a courtesy to reddit"
r = praw.Reddit(USERAGENT)
@dotkwame
dotkwame / ItemClickSupport.java
Created May 12, 2017 20:48 — forked from nesquena/ItemClickSupport.java
Click handling for RecyclerView
/*
Source: http://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/
USAGE:
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
@Override
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
// do it
}
});