Skip to content

Instantly share code, notes, and snippets.

View jcayzac's full-sized avatar

Julien Cayzac jcayzac

View GitHub Profile
<div role="math" tabindex="0" aria-label="3 times the identity matrix">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
<mrow>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mo form="prefix">&minus;</mo>
<mi>b</mi>

Exporting Skype history (mac)

$ cd /tmp
# The app doesn't handle paths with spaces so we make a symlink with no space in its path
$ ln -s ~/Library/Application\ Support appsupport
$ APPDATA=/tmp/appsupport java -jar /path/to/exportskype-1.0.4.jar
@jcayzac
jcayzac / latest_xcode.sh
Last active December 19, 2015 02:28
Detect latest available Xcode version
#!/usr/bin/env bash
latest_xcode() {
local XcodePath XcodeVersion XcodeVersionMajor XcodeVersionMinor
for XcodePath in /Applications/Xcode*.app
do
XcodeVersion="$(defaults read "${XcodePath}/Contents/Info" CFBundleVersion)"
XcodeVersionMajor=${XcodeVersion%%.*}
if [ "$XcodeVersion" == "$XcodeVersionMajor" ]
then
XcodeVersionMinor=0
@jcayzac
jcayzac / download.sh
Created July 4, 2013 07:29
super-simple http download in bash
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
[ "${1%%:*}" == "http" ]
url="${1##*://}"
host="${url%%/*}"
path="${url#*/}"
exec 3<>/dev/tcp/${host}/80

Low-carb macadamia chocolate fondant

pic

Ingredients

  • 3 large egg whites
  • 15-18 macadamia nuts (35g)
  • 3 tbsp erythritol or another sweetener
  • 1 tbsp coconut oil (liquid)
  • 1 tbsp heavy cream
@jcayzac
jcayzac / gist:7094030
Created October 22, 2013 01:54
Export GMail inbox messages as EML files
118 messages to export:
curl -s -L -b "$GMAIL_COOKIE" 'https://mail.google.com/mail/h/?st=[0-100:100]' | grep -Eo 'th=[0-9a-f]+"' | while read LINE; do echo >&2 -n '.' ; curl -s -L -b "$GMAIL_COOKIE" "https://mail.google.com/mail/h/1khzd2wj8gtee/?&v=om&th=${LINE:3:16}" | tr -d '\r' >"$(uuidgen).eml" ; done
…then drag'n'drop to a Thunderbird folder.
javascript:%28function%20%28%29%20%7Bvar%20selection%20%3D%20window.getSelection%20%3F%20window.getSelection%28%29%20%3Adocument.getSelection%20%3F%20document.getSelection%28%29%20%3Adocument.selection%20%3F%20document.selection.createRange%28%29.text%20%3A%20%27%27%3Bif%20%28selection%29%20%7Bselection%20%3D%20String%28selection%29%3B%7Dif%20%28selection%29%20%7Bvar%20match%20%3D%20selection.match%28%27%5C%2F%28.%2A%29%5C%2F%27%29%3Bvar%20ipa%3Bif%20%28match%20%26%26%20match%5B1%5D%29%20%7Bipa%20%3D%20match%5B1%5D%3B%7Dif%20%28%21ipa%29%20%7Bipa%20%3D%20prompt%28%22Couldn%27t%20find%20any%20IPA.%20Type%20it%20in%20instead%3F%22%29%3B%7Dif%20%28ipa%29%20%7Bipa%20%3D%20ipa.replace%28%2F.%2Fg%2C%20function%20%28c%29%20%7Bif%20%28%2F%25u0%28...%29%2F.test%28escape%28c%29%29%29%20%7Breturn%20escape%28c%29.replace%28%2F%25u0%28...%29%2Fg%2C%20%27%26%23x%241%3B%27%29%3B%7D%20else%20%7Breturn%20c%3B%7D%7D%29%3Bvar%20request%20%3D%20%7Btxt%3A%20%27%3Cphoneme%20alphabet%3D%22ipa%22%20ph%3D%22%27%2Bipa%2B%27%22%3E%20%3
(function(d,f){f(d,'jIAAABXRUJQVlA4ICYAAACyAgCdASoCAAEALmk0mk0iIiIiIgBoSygABc6zbAAA/v56QAAAAA==')&&f(d,'h4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=')&&d.documentElement.classList.add('webp')})(document,function(d,x,i){return i=d.createElement('img'),i.src="data:image/webp;base64,UklGR"+x,i.width==2&&i.height==1})
@jcayzac
jcayzac / build
Created February 12, 2014 06:50
Overwrite platform/ios/cordova/build
#!/bin/bash
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj )
PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
source "$CORDOVA_PATH/check_reqs"
cd "$PROJECT_PATH"
// Proper exceptions in JS:
function MakeErrorClass(name, parent) {
parent = parent || Error
var cls = function(message) {
parent.call(this, arguments)
if (Error.captureStackTrace)
Error.captureStackTrace(this, this.constructor)
else
this.stack = [name].concat(Error().stack.split('\n').slice(3)).join('\n')