This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Place this file on /etc/update-ddns.conf | |
# SECURITY: run `chmod 600 /etc/update-ddns.conf' | |
# to make it unreadable by non-root users. | |
DOMAIN= | |
PASSWORD= | |
HOST= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.ypresto.utils.squareview; | |
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.FrameLayout; | |
/** | |
* FrameLayout enforces its aspect ratio to 1:1. | |
* NOTE: wrap_content is not supported. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ uname -a | |
Linux (hostname) 3.14.25-23.45.amzn1.x86_64 #1 SMP Wed Dec 3 21:29:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux | |
$ cat /proc/sys/vm/vfs_cache_pressure | |
100 | |
$ free -m | |
total used free shared buffers cached | |
Mem: 996 922 74 0 28 133 | |
-/+ buffers/cache: 760 236 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
message="$TRAVIS_REPO_SLUG $TRAVIS_BRANCH build failed <!channel>" | |
payload="payload={\"text\": \"${message}\"}" | |
curl --silent --max-time 5 --data "${payload}" "https://hooks.slack.com/services/${SLACK_TOKEN}" | grep -Ei '^ok$' > /dev/null || echo 'Failed to notify.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed-inplace () { | |
if (( $# < 2 )); then | |
echo "sed-inplace FROM TO [PATH ...]" | |
return 1 | |
fi | |
from="$1" | |
to="$2" | |
shift 2 | |
ag -l "$from" "$@" | while read file; do | |
if [ "`uname`" = "Darwin" ]; then # please, please give me portable sed... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* MCLayoutGuideHelper.h | |
* Yuya Tanaka | |
* | |
* This is free and unencumbered software released into the public domain. | |
* | |
* Anyone is free to copy, modify, publish, use, compile, sell, or | |
* distribute this software, either in source code form or as a compiled | |
* binary, for any purpose, commercial or non-commercial, and by any | |
* means. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Place this on chroot target dir. | |
umount=0 | |
[ "$1" = "-u" ] && umount=1 | |
for dir in dev proc sys; do | |
if (( $umount )); then | |
umount ./$dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rx.Observable; | |
import rx.Subscriber; | |
import rx.functions.Action0; | |
import rx.subscriptions.CompositeSubscription; | |
import rx.subscriptions.Subscriptions; | |
public class SubscriptionUtils { | |
/** | |
* Automatically adds to / removes from specified {@link CompositeSubscription} when subscribe / unsubscribe is called. | |
* Useful when subscribing observable repeatedly, as you do not need to manipulate CompositeSubscription manually. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2011 The Android Open Source Project | |
* Copyright (C) 2015 Yuya Tanaka | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Namespace('brook.rxjsbridge') | |
.use('brook promise') | |
.define(function(ns) { | |
'use strict'; | |
var observableFromPromise = function(promise, value) { | |
return Rx.Observable.create(function(observer) { | |
var called = false; | |
var throwIfCalled = function() { | |
if (called) { | |
throw new Error('promise resolved twice.'); |