Skip to content

Instantly share code, notes, and snippets.

View justlaputa's full-sized avatar
:octocat:
coding 🐾🐾

Han Xiao justlaputa

:octocat:
coding 🐾🐾
  • PayPay
  • Tokyo, Japan
View GitHub Profile
@justlaputa
justlaputa / tmux.md
Created June 24, 2016 02:54 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@justlaputa
justlaputa / SimpleHTTPServerWithUpload.py
Created June 21, 2016 10:46 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
var codes = []
$('table.basic>tbody tr td[lang="en"]').each(function(i) {
td = $(this)
en_name = td.text()
siblings = td.siblings()
ja_name = siblings.get(0).textContent
iso_3166_2_code = siblings.get(1).textContent
codes.push({
version: "2"
services:
mongodb:
container_name: mongodb
image: mongo:3.2
volumes:
- ./data/db:/data/db
ports:
- "27017:27017"
@justlaputa
justlaputa / get-imdb-oscar-movies.js
Last active March 6, 2016 14:44
run this script in chrome console in imdb's oscar awards page, you can get a list of all oscar movies
var movies = {}
var order = 0
function getLink(link) {
link = link.substring(0, link.lastIndexOf('?'))
return 'http://www.imdb.com' + link
}
function addMovie(category, title, link) {
if (!movies[title]) {
@justlaputa
justlaputa / setup-single-node-mesos.sh
Created December 8, 2015 10:37
setup single node mesos cluster by using docker
#!/bin/bash
HOST_IP=`ip -4 addr show eno1 | grep inet | awk -F'[ /]' '{print $6}'`
docker run -d \
-p 2181:2181 \
-p 2888:2888 \
-p 3888:3888 \
garland/zookeeper
#!/bin/bash
#
# Prepends a date string in front of the Maven output.
# A workaround for http://jira.codehaus.org/browse/MNG-519 "Timestamps on messages"
[ -z "${AWK}" ] && AWK="$(which gawk 2>/dev/null)" || AWK="$(which awk 2>/dev/null)" || { echo "Error: Could not find AWK tool."; exit 1; }
"${AWK}" 'BEGIN { print strftime("%Y-%m-%d %H:%M:%S"); }' 2>&1 > /dev/null || { echo "Error: your AWK version does not support strftime() function." && exit 1; }
mvn "${@}" 2>&1 |"${AWK}" '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }'
# see comp.unix.shell FAQ: (http://cfajohnson.com/shell/cus-faq-2.html)
@justlaputa
justlaputa / primary.sql
Created April 11, 2014 09:24
find primary key of table
SELECT
cols.table_name,
cols.column_name,
cols.position,
cons.status,
cons.owner
FROM all_constraints cons,
all_cons_columns cols
WHERE cols.table_name = 'TABLE_NAME'
AND cons.constraint_type = 'P'
@justlaputa
justlaputa / bower-check.js
Created June 3, 2013 10:42
js library to check component version before running `bower install`
/*global module:false,process:false*/
/**
* helper script for Grunt bower task
* this script is used to compare javascript libraries versions
* installed by bower, and run `bower install` only when necessary
*/
var fs = require('fs');
var bower = require('bower');
var components = require('./bower.json');
@justlaputa
justlaputa / jenkins-api.md
Last active November 20, 2024 11:56
Jenkins Json API

jobs

jenkins_url + /api/json?tree=jobs[name,color]

builds

jenkins_url + /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]

last build