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
""" | |
In jupyter notebook simple logging to console | |
""" | |
import logging | |
import sys | |
logging.basicConfig(stream=sys.stdout, level=logging.INFO) | |
# Test | |
logger = logging.getLogger('LOGGER_NAME') |
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
require 'csv' | |
# Parses CSV-exported data from SleepBot | |
def parse_export(row) | |
# Parse the wake up date | |
date_to = row[0].split('/') | |
date_to = Time.new(2000 + date_to[2].to_i, date_to[1], date_to[0]) | |
# Parse the wake up/sleep times | |
time_from = row[1].split(':') |
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
require 'selenium-webdriver' | |
Selenium::WebDriver::Chrome.driver_path="/path/to/chrome_driver_binary/chromedriver" | |
driver = Selenium::WebDriver.for :chrome | |
driver.get("http://google.com") |
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 sqlite3 | |
def get_chrome_cookies(): | |
conn = sqlite3.connect('/home/<username>/.config/chromium/Default/Cookies') | |
query = 'select name, value, path from cookies where host_key=".livejournal.com";' | |
return [{"name": r[0], "value": r[1], "path": r[2]} for r in conn.execute(query)] |
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
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
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
#!/bin/bash | |
# | |
# Run this script once per day | |
# | |
DOMAIN="ZHOVNER.COM" | |
if [ ! -f /tmp/$DOMAIN.old.whois.txt ]; then |