Skip to content

Instantly share code, notes, and snippets.

View dacort's full-sized avatar
🤔
Thinking about some new idea...

Damon P. Cortesi dacort

🤔
Thinking about some new idea...
View GitHub Profile
@benjsicam
benjsicam / metabase-scaling.md
Last active October 19, 2022 07:53
Metabase Horizontal Scaling

Overview

Below is a Docker Compose file with 3 instances of Metabase connecting to the same PostgreSQL database and a shared volume mount.

version: "3"

services:
  metabase-instance1:
    image: "metabase/metabase:v0.32.9"
@andrewgross
andrewgross / dynamic_partition.py
Last active May 25, 2018 18:35
PySpark scripts to predict the number of partitions needed to get good output file sizes (100-300MB for Parquet). Also a helper function to determine your average byte array size.
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
@altryne
altryne / Readme.md
Created May 7, 2014 17:46
Hubot Slack webhook

#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.

@dmitshur
dmitshur / gist:6927554
Last active September 17, 2023 07:35
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.

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!
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@jehiah
jehiah / activity_snapshot.sh
Created January 7, 2013 18:43
A cron job script to capture computer activity every 30 seconds
#!/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 ))
@jehiah
jehiah / iphone_messages_dump.py
Last active September 28, 2020 03:53
Script to dump out messages to csv from an iPhone Backup sqlite file
# Copyright Jehiah Czebotar 2013
# http://jehiah.cz/
import tornado.options
import glob
import os
import sqlite3
import logging
import datetime
import csv
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/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
#
@kyledrake
kyledrake / gist:2120107
Created March 19, 2012 17:24
Rainbows! config file for use with EventMachine
# 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
@axelav
axelav / gist:1839777
Created February 15, 2012 22:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt