Skip to content

Instantly share code, notes, and snippets.

@ojas
ojas / chapter23.md
Created November 20, 2016 22:44
The Demon-Haunted World - Maxwell and the Nerds - Carl Sagan

Maxwell and The Nerds

Why should we subsidize intellectual curiosity?

– Ronald Reagan, campaign speech, 1980

There is nothing which can better deserve our patronage than the promotion of science and literature. Knowledge is in every country the surest basis of public happiness.

– George Washington, address to Congress, 8 January 1790

@ojas
ojas / requests_curl_logger.py
Last active November 10, 2016 17:37
Python Helpers
"""
Log your requests activity in curl format and with pretty colors.
import requests
from requests_curl_logger import curl_log
r = requests.get('http://example.com', hooks=dict(response=curl_log))
"""
from json import dumps as json_dumps
@ojas
ojas / trump.py
Created October 25, 2016 20:37
Trump-ify
#!/usr/bin/env python
def trumpify(x):
return '“Nobody %s more than me.” – Donald Trump' % x
if __name__ == "__main__":
things = ['repects women', 'understands the horror of nuclear', 'reads the Bible', ]
for thing in things:
print(trumpify(thing))
@ojas
ojas / email.html
Last active October 24, 2016 21:32
Hubspot Email Rendering Issue in iOS Mail
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>
<title></title>
<meta property="og:title" content="">
<meta name="twitter:title" content="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" id="hs-inline-css">
/*<![CDATA[*/
/* everything in this node will be inlined */
@ojas
ojas / refresh_css.txt
Created September 19, 2016 16:43
Hacks
// run this in your console…
(function(){
var nc = (new Date()).valueOf();
jQuery('style').each(function() {
var c = this.innerHTML;
if (c.indexOf('@import')!==-1)
this.innerHTML = c.replace('.css?', '.css?' + nc );
});
})();
@ojas
ojas / monty hall
Created February 9, 2015 22:07
Monty Hall
{
"metadata": {
"name": "",
"signature": "sha256:54dd0380143918c25eba34914e70f3100831189ab021b2871dcf92f0b5cce9d3"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@ojas
ojas / birthday_problem
Last active August 29, 2015 14:15
Notebooks
{
"metadata": {
"name": "",
"signature": "sha256:0c025d13898e4457f1df2d19f109c610049acaa5b621e1c9aa0135551011f5f1"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@ojas
ojas / excel_comments_export.vba
Created October 3, 2014 15:55
Office Macros
' via http://www.extendoffice.com/documents/excel/1579-excel-export-comments-to-word.html
Sub CopyCommentsToWord()
'Update 20140325
Dim xComment As Comment
Dim wApp As Object
On Error Resume Next
Set wApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Err.Clear
@ojas
ojas / MacTips.md
Last active October 5, 2016 00:16
Mac Tips

How to find what program's running on a given port

See what's running on port 80

sudo lsof -i :80

Restart Audio

sudo kill -9 `ps ax|grep 'coreaudio[a-z]' |awk '{print $1}'`
@ojas
ojas / Auto Manufacturers Model Name Laziness Score.md
Last active August 29, 2015 14:05
Auto Manufacturers Model Name Laziness Score

Car Model Name Laziness Score

Summary

Make Laziness Score
Volvo 100.0
Acura 100.0
Scion 100.0
Fiat 100.0