Skip to content

Instantly share code, notes, and snippets.

@tannie
tannie / json-fb-unicode.rb
Created March 23, 2022 09:30
Fix Facebook's unicode issues (in the downloaded archive of your data)
#!/usr/bin/env ruby
require 'json'
file = File.open(ARGV[0])
bytes_re = /((?:\\\\)+|[^\\])(?:\\u[0-9a-f]{4})+/
content = file.read.gsub(bytes_re) do |bad_unicode|
$1 + eval(%Q{"#{bad_unicode[$1.size..-1].gsub('\u00', '\x')}"}).to_json[1...-1]
@tannie
tannie / json-split.rb
Last active March 22, 2022 17:16 — forked from matt-west/json-split.rb
Ruby script to split a JSON file
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
puts "Opening File"
file = File.open(ARGV[0])
puts "Fetching Contents"
bytes_re = /((?:\\\\)+|[^\\])(?:\\u[0-9a-f]{4})+/

Keybase proof

I hereby claim:

  • I am tannie on github.
  • I am tanja (https://keybase.io/tanja) on keybase.
  • I have a public key whose fingerprint is 5BFD 9306 DC8E 5DDE 5ECB C4E8 3440 C0F3 41DD D224

To claim this, I am signing this object: