Skip to content

Instantly share code, notes, and snippets.

View doxavore's full-sized avatar

Doug Mayer doxavore

View GitHub Profile
@doxavore
doxavore / using-google-takeout.md
Created February 13, 2022 20:54 — forked from chabala/using-google-takeout.md
Merge and extract tgz files from Google Takeout

Recently found some clowny gist was the top result for 'google takeout multiple tgz', where it was using two bash scripts to extract all the tgz files and then merge them together. Don't do that. Use brace expansion, cat the TGZs, and extract:

$ cat takeout-20201023T123551Z-{001..011}.tgz | tar xzivf -

You don't even need to use brace expansion. Globbing will order the files numerically:

$ cat takeout-20201023T123551Z-*.tgz | tar xzivf -
@doxavore
doxavore / gist:3722096
Created September 14, 2012 14:07
Convert all CoffeeScript files to JavaScript

Is this really necessary? It seems like a bit of work...

In Vim, make all comments stick:

:arg **/*.js.coffee
:argdo %s/^\(\s*\)#/\1#!/ge

Compile from CoffeeScript to JavaScript (npm install -g coffee-script):

-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFyb5j4BEADG9vEWQO7AragedbBW/J9+voMpqsFQVmGEOjXBUcvJhh5SvRiX
Cdpgp9ubTjGgjn06r0D3/Vu3Zx1y0LLMd7HjK9YTaBBD3c5vBWkLFOUr4vlu24DM
hWbOK3GxdaZ+QAEcR+oy9aM4Lb9cdpZykE7/Y6Zu98lwbYnUJqLAaBLVnSX6JYPJ
rdA0bGwU7skv3r0HGawAls6CKhWxLRX52LRRPhHHaws0ZdGIDvZfrjkB38PefWJu
CKe79Ykxst2ARip53rzLjrT7+Lko31L0afFI8Wf11FgfO/4paly8kp4WqarGqJY9
qdPdj+Ty7BLjtulGm4frUbMG8tlBLPFg8OM5l1wObSCDJ2fd38GmijS2ZIto3mr3
8qb6BmF2x2l6kzofVPCK0GDnij+ohlTLBzvQUzPQtCj4hVJnAamDmrPtm9OoFbal
ZY4Zi6J6BYy//ATYHyMUpfD/kZMhMYp3AT65MDmlyHSZGSG2zi8Hk5iN1iRX8dPh

Keybase proof

I hereby claim:

  • I am doxavore on github.
  • I am doxavore (https://keybase.io/doxavore) on keybase.
  • I have a public key ASDlK-KxFeOel3yPAYno_OKpFZNYRVa_oHFcVL5r07JIYwo

To claim this, I am signing this object:

@doxavore
doxavore / jruby_timeout_process.rb
Created January 17, 2014 19:12
JRuby (tested on 1.7.4 and 1.7.9) exits after 10 seconds. MRI exits after 5 seconds.
require 'timeout'
puts "Starting at #{Time.now}"
begin
Timeout.timeout(5) do
`sleep 10`
puts 'after sleep'
end
rescue Timeout::Error
puts 'timed out'
@doxavore
doxavore / timers_test.rb
Last active January 2, 2016 10:09
Timers 2.0.0 on JRuby 1.7.4
>> require 'timers'
true
>> timers = Timers.new
#<Timers:0x322114c1 @interval=#<Hitimes::Interval:0x19d9a49d>, @timers=#<SortedSet: {}>, @paused_timers=#<SortedSet: {}>>
>> timer = timers.after(5) { puts 'hello' }
#<Timers::Timer:81e fires in 4.995706082 seconds>
# ... never fires
# Also, this doesn't seem to work, from the specs:
require 'spec_helper'
describe Celluloid::SupervisionGroup, actor_system: :global do
before :all do
class MyActor
include Celluloid
def running?; :yep; end
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE template SYSTEM "../../../project-config.dtd">
<template>
<name>Rails</name>
<settings>
<options>
<option name="executionTimeoutMin" value="20" />
</options>
<parameters>
# Output line:
2013-11-14 22:07:08.266 UTC [6687] - [postgres@[local] pgbench] SELECT - ERROR: column "sync_statex" does not exist at character 20
# Logstash grok matcher...
# In config file:
%{DATESTAMP:timestamp} UTC \\[%{POSINT:pid}\\] - \\[%{WORD:user}@\\[local\\] %{WORD:db}\\] %{WORD:command} - %{WORD:level}:%{SPACE}%{GREEDYDATA:message}
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"