Skip to content

Instantly share code, notes, and snippets.

@doxavore
doxavore / using-google-takeout.md
Created Feb 13, 2022 — forked from chabala/using-google-takeout.md
Merge and extract tgz files from Google Takeout
View using-google-takeout.md

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 Sep 14, 2012
Convert all CoffeeScript files to JavaScript
View gist:3722096

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):

View BF5ED7AA24BC4F8A.asc
-----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
View keybase.md

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 Jan 17, 2014
JRuby (tested on 1.7.4 and 1.7.9) exits after 10 seconds. MRI exits after 5 seconds.
View jruby_timeout_process.rb
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 Jan 2, 2016
Timers 2.0.0 on JRuby 1.7.4
View timers_test.rb
>> 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:
View celluloid_supervision_group_spec.rb
require 'spec_helper'
describe Celluloid::SupervisionGroup, actor_system: :global do
before :all do
class MyActor
include Celluloid
def running?; :yep; end
end
View RailsTemplate.xml
<?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>
View gist:7475186
# 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}
View gist:7364989
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"