Skip to content

Instantly share code, notes, and snippets.

@williesong
williesong / crawler_amazon.py
Last active July 19, 2019 05:12
A simple crawler to search for products by keyword on Amazon.
import requests
from bs4 import BeautifulSoup
URL_ROOT = 'https://www.amazon.com'
URL_SEARCH = URL_ROOT + '/s?k='
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/75.0.3770.142 Safari/537.36'}
@williesong
williesong / DebugUtils.kt
Created May 9, 2018 10:38
Android debug utilities to export SQLite, Realm, SharedPreferences and Logcat to external files directory.
object DebugUtils {
private val TAG = LogUtils.makeLogTag("DebugUtils")
/**
* Export SQLite DB to external files directory.
*
* @param context The context to use.
* @param name SQLite DB name.
*/
fun exportSQLite(context: Context, name: String) {
@williesong
williesong / DebugUtils.java
Last active May 9, 2018 10:31
Android debug utilities to export SQLite, Realm, SharedPreferences and Logcat to external files directory.
public class DebugUtils {
private static final String TAG = LogUtils.makeLogTag("DebugUtils");
private DebugUtils() {
}
/**
* Export SQLite DB to external files directory.
*
* @param context The context to use.
@williesong
williesong / colors_material.xml
Last active July 23, 2019 06:30
XML resource file for material design colors. https://material.google.com/style/color.html
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Red -->
<color name="red_50">#FFEBEE</color>
<color name="red_100">#FFCDD2</color>
<color name="red_200">#EF9A9A</color>
<color name="red_300">#E57373</color>
<color name="red_400">#EF5350</color>
<color name="red_500">#F44336</color>