⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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
# | |
# NOTE: This gist is now deprecated and has been moved into a gem: https://github.com/reidmorrison/mongo_ha | |
# | |
require 'mongo/collection' | |
module Mongo | |
class Collection | |
alias_method :find_one_original, :find_one | |
def find_one(*args) |
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
# This is a configuration script for using Rainbows with EventMachine. I'm providing it incase somebody finds it useful. But honestly, you | |
# should stop using EventMachine and use threads instead. The ThreadPool version of this is also in my gist list, and I recommend taking a look at that instead. | |
# NO, SERIOUSLY, STOP USING EVENTMACHINE. | |
Rainbows! do | |
name = 'yourappname' | |
use :EventMachine | |
client_max_body_size nil # This is set in nginx | |
# keepalive_timeout 1 |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
# Copyright Jehiah Czebotar 2013 | |
# http://jehiah.cz/ | |
import tornado.options | |
import glob | |
import os | |
import sqlite3 | |
import logging | |
import datetime | |
import csv |
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/sh | |
# computer activity data collection for http://jehiah.cz/one-two/ | |
# by Jehiah Czebotar | |
FILE="activity_log/`date +%Y%m%d`.log" | |
function log_activity() | |
{ | |
local UTC=`date "+%s,%Z"` | |
local IDLE=$((`/usr/sbin/ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/!{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000 )) |
WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
#A script to post back to Slack via the webhooks API
##why this exists?
Slack's own hubot adapter needs the hubot installation to be accessible via web. This can be problematic in some cases, as a security risk.
This hack let's you run your Hubot behind a firewall, and connect to Slack via the IRC gateway.
To respond, Hubot uses the incoming webhooks end-point of Slack.
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
def get_files_per_partition(df, partition_key, file_type="parquet", compression="snappy", byte_array_size=256): | |
rows = df.count() | |
print "Dataset has {} rows".format(rows) | |
schema = df.schema | |
num_partitions = 1 | |
if partition_key is not None: | |
num_partitions = df.select([partition_key]).distinct().count() | |
print "Dataset has {} distinct partition keys".format(num_partitions) | |
_df = df.drop(partition_key) | |
schema = _df.schema |