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 | |
# License: Public Domain. | |
# Author: Joseph Wecker, 2012 | |
# | |
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile? | |
# Are you tired of trying to remember how darwin/mac-osx treat them differently from linux? | |
# Are you tired of not having your ~/.bash* stuff work the way you expect? | |
# | |
# Symlink all of the following to this file: | |
# * ~/.bashrc |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
svg { | |
float: left; | |
} | |
line { | |
shape-rendering: crispEdges; | |
stroke-width: 1px; |
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
/** | |
* Looks for rows with old dates, and hides them if so. | |
* It finds the date column my checking the first column for the word 'Date'. | |
*/ | |
function hideOldRows(colNum) { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var header = sheet.getRange(1, 1, 1, sheet.getLastColumn()); | |
var colNum = header.getValues()[0].indexOf('Date') + 1; | |
if (colNum === 0) { | |
Logger.log(header.getValues()); |
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
<link rel="import" href="../code-mirror/code-mirror.html"> | |
<link rel="import" href="../speech-mic/speech-mic.html"> | |
<link rel="import" href="../yt-video/yt-search-video.html"> | |
<link rel="import" href="../cool-clock/cool-clock.html"> | |
<link rel="import" href="../paper-radio-button/paper-radio-button.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> |
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
# Makefile tutorial, through examples | |
# This is not a makefile! I just called it as such to have vim coloring work well. | |
######## | |
# This makefile will always run. The default target is some_binary, because it is first. | |
######## | |
some_binary: | |
echo "nothing" | |
######## |
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
# Q: Given a list of length n+1 with numbers from 1 to n, there will be at least one duplicate. Find it. | |
# Running time: O(n). Space: O(1). Or rigorously O(lgn) given that a constant variable to represent the number "n" grows with lgn. | |
# http://stackoverflow.com/questions/6420467/find-any-one-of-multiple-possible-repeated-integers-in-a-list/6420503#6420503 | |
import random | |
import pytest | |
def find_dup(lst): | |
assert(len(lst) >= 2) | |
assert(all(map(lambda x: 0 < x < len(lst), lst))) | |
#find cycle |
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
# Find sqrt(2) | |
# Get a graph of y^2 - 2, find the 0. Use newtons's method. | |
import math | |
def iterate_root(start, n, p): | |
dx = .01 | |
dy = ((start + dx) ** p) - (start ** p) | |
return start - ((start**p) - n)/(dy/dx) | |
def get_sqrt(n): |
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
hi there |
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
/** | |
* Usage: Call BigAutorelease* a = create_autorelease_object();. If the dealloc message is not printed, this code is not running in an autorelease pool block. | |
*/ | |
@interface BigAutorelease: NSObject | |
@property(strong, nonatomic) NSMutableArray *arr; | |
@end | |
@implementation BigAutorelease | |
- (instancetype)init { | |
NSLog(@"Make BigAutorelease"); |
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 { Socket } = require('net'); | |
const { Duplex } = require('stream'); | |
class JsonSocket extends Duplex { | |
/** | |
JsonSocket implements a basic wire-protocol that encodes/decodes | |
JavaScripts objects as JSON strings over the wire. The wire protocol | |
is defined as: | |
4 len - length of JSON body |
OlderNewer