Skip to content

Instantly share code, notes, and snippets.

View raphaelmerx's full-sized avatar

Raphaël Merx raphaelmerx

View GitHub Profile
@raphaelmerx
raphaelmerx / gist:b3b4f1b5e569cd4f4f5c
Created April 20, 2015 23:27
Delete scout server
# Script using scout api to delete the provided server
if ARGV.length < 4
puts "Please specify hostname of scout server you wish to remove"
puts "USAGE: delete_scout_entry.rb <account name> <username> <password> <server hostname>"
exit(0)
end
require 'scout_api'
scout = Scout::Account.new(ARGV[0], ARGV[1], ARGV[2])

Follows https://codewords.recurse.com/issues/two/git-from-the-inside-out

  • Adding a file will hash its content, and add a file in the objects directory to track it. The object content is just a compressed version of the file contents. The first two letters of the file content become the directory that the object is stored in, and the rest of the hash is the object file name.
  • Each object is a full snapshot of the file content. It does not represent a diff. Because the file name and location are not stored in the blobs, two identical files will point to the same blob.
  • When there are too many loose objects, git packs them into the pack folder that can store diffs instead of full file contents.
  • When commiting, git creates a snapshot of the current blobs and trees. trees are used to track directories, and point to blobs or other trees. Files are represented by blobs.
  • A commit is also an object, that points to the tree for the root directory: https://codewords.recurse.com/images/two/git-from-the-i

Extracting a full image from the master tablet

You will need:

  • Ubuntu (or other Linux distribution) computer
  • TWRP image for your tablet model. Search for it on https://twrp.me/Devices/
  • latest firmware for the Android tablet. For example download it from sammobile.
  • The heimdall command. Download it with sudo apt-get install heimdall-flash
  • Binaries for manipulating Android images: ext2simg and sgs4ext4fs.
@raphaelmerx
raphaelmerx / android-sdk.rb
Created November 28, 2017 04:34
Brew formula for android-sdk 24.4.1
require "base64"
class AndroidSdk < Formula
desc "Android API libraries and developer tools"
homepage "https://developer.android.com/index.html"
url "https://dl.google.com/android/android-sdk_r24.4.1-macosx.zip"
version "24.4.1"
sha256 "ce1638cb48526a0e55857fc46b57eda4349e6512006244ad13dd6c1361c74104"
revision 1
@raphaelmerx
raphaelmerx / get_vocab.py
Created January 31, 2019 01:42
Extract vocabulary from lines
#! /usr/bin/env python
""" Example usage: python get_vocab.py --input lines_tet.txt --output vocab.tet. """
from __future__ import print_function
import os
import sys
import inspect
import warnings
import argparse
import codecs

Deal

Three players each receive 12 cards from a 36-pack ranking A K Q J T 9 8 7 6 in each suit. The turn to deal and play passes always to the left.

Objective

The players each lay aside three bid-cards and play the remaining nine cards to tricks. Each player aims to win exactly as many tricks as indicated secretly and in code by their bid-cards. For this purpose, the suits of the bid-cards represent numbers of tricks bid as follows:

[club] = 3 tricks [heart] = 2 tricks [spade] = 1 trick [diamond] = 0 tricks

<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>test</h:title>
<model>
<instance>
<test id="test" version="vmexRbhSYZzmxbEKqDC2oy">
<start/>
<end/>
<Incident_title/>
<GPS_coordinates/>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>paper survey</h:title>
<model>
<itext>
<translation default="true()" lang="English">
<text id="/xlsform-paper-survey/section_2/households_in_village:label">
<value>Approximately how many households are in the village?</value>
<value form="image">/static/img/households.png</value>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>event-report-xlsform</h:title>
<model>
<itext>
<translation default="true()" lang="English">
<text id="static_instance-category-0">
<value>Logging</value>
</text>
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>test</h:title>
<model>
<instance>
<animal-test id="animal-test">
<animal_more_or_less_1/>
<meta>
<instanceID/>