Skip to content

Instantly share code, notes, and snippets.

test=> SELECT sid, lid, COUNT(id) FROM attend GROUP BY sid, lid HAVING COUNT(id) > 1;
sid | lid | count
-----+---------+-------
336 | ACB0030 | 2
325 | ABF0030 | 2
(2 rows)
test=> SELECT id FROM attend WHERE sid = 336 AND lid = 'ACB0030';
id
-------
#!/bin/bash
INTERVAL=5
REBOOT_BORDER=10
MAILTO="rudeboyjet@gmail.com"
LOG_DIR="/var/log/loadavg"
mkdir -p $LOG_DIR
while :
do
LOAD_AVG=$( uptime | awk '{print $10}' | cut -d "." -f 1 )
jQuery ($) ->
new Vue(
el: '#app',
data:
msg: 'Hello Vue.js!'
)
class QuestsCleanupJob < ActiveJob::Base
queue_as :default
def perform(*args)
# Do something later
end
end
@yalab
yalab / Makefile
Created January 21, 2015 07:11
Compile cocos2d-x for CLI tool
TARGET = serializer
CXX = clang++
CC = clang
LDLIB_DIR = -I../../../zeron/cocos2d/cocos \
-I../../../zeron/cocos2d/cocos/2d \
-I../../../zeron/cocos2d/cocos/editor-support \
-I../../../zeron/cocos2d/external/glfw3/include/mac \
-I../../../zeron/cocos2d/extensions \
-I../../../zeron/cocos2d/external \
@yalab
yalab / build.gradle
Created February 16, 2015 11:48
proj.android/build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
}
}
apply plugin: 'android'
@yalab
yalab / gist:76576966c9475aa2510e
Created March 18, 2015 00:58
cocos2d-x でピンポイントに GooglePlay の課金を消費させる関数
private void clearPurchases() {
mHelper = new IabHelper(getContext(), "GOOGLE_TOKEN");
mHelper.enableDebugLogging(true);
Log.v(TAG, "mHelper.startSetup");
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// 失敗した時の処理
}
List additionalSkuList = new ArrayList();
@yalab
yalab / heroku_mongo_backup
Created November 17, 2011 10:24
Backup scripts MongoHQ databases using heroku.
#!/bin/bash
HEROKU="/home/yalab/.rvm/gems/ruby-1.9.3-p0/bin/heroku"
BACKUP_DIR="$HOME/.backup/mongohq"
if [ ! -d $BACKUP_DIR ];then
mkdir -p $BACKUP_DIR
fi
for APP in `$HEROKU list`;do
MONGOHQ_URL=`heroku config --app $APP | grep MONGOHQ_URL | awk '{print $3}'`
@yalab
yalab / gist:1504270
Created December 21, 2011 02:20
STDERR redirect to STDOUT
# stderr_to_stdout do
# warn("warning message")
# end
module Kernel
def stderr_to_stdout
old_std_err = STDERR.clone
STDERR.reopen(STDOUT)
yield
ensure
@yalab
yalab / ssh_tunnel.sh
Created January 12, 2012 00:05
SSH Tunnering
#!/bin/zsh
USER='yalab'
SOURCE_HOST='YOUR GLOBAL IP ADDRESS'
SOURCE_PORT=8888
DEST_HOST='DESTINATION HOST IP ADDRESS'
DEST_PORT=22
SSH_KEY='/home/yalab/.ssh/id_rsa'
sudo kill `ps ax | grep 'ssh -N'| awk '{print $1}'`