Skip to content

Instantly share code, notes, and snippets.

View manboubird's full-sized avatar

Toshiaki Toyama manboubird

View GitHub Profile
@dekokun
dekokun / jenkins_plugin_install.sh
Last active December 2, 2019 03:10
Jenkinsで私が使ってるプラグインをコマンドからインストール
#!/bin/bash
# PLUGINS=で始まってる行をコメントアウトしたり追加したりして、
# 好きなプラグインをインストールできるよ。
# まぁ、普通は、JenkinsのWeb UIから「プラグインの管理」でインストールすればいいと思う。
# 同じ環境を何個も作りたい場合はこのスクリプトをどうぞ。
PLUGINS=()
# Jenkin Build Pipeline Plugin
@darekmydlarz
darekmydlarz / scala-gson.scala
Created September 5, 2012 17:48
Scala + Gson
// lib to add: http://code.google.com/p/google-gson/downloads/detail?name=google-gson-2.2.2-release.zip&can=2&q=
// file Main.scala
package demo
import scala.collection.JavaConverters._
import com.google.gson.Gson
import java.util.ArrayList
import java.lang.reflect.Type
import com.google.gson.reflect.TypeToken
@doryokujin
doryokujin / 0.basics.sql
Created July 22, 2012 09:04
退会に関する分析
-- 0.1 ログインインターバルの分布 --
-- 当日入会->辞めた人もインターバルは1となるので1回以上プレイしている人に限定 --
td query -w -d your_app -f csv -o dist_of_login_interval.csv "
SELECT ROUND((datediff(latest_login, registered_day)+1)/login_times) AS login_interval, COUNT(*) AS cnt
FROM
(
SELECT v['uid'] AS uid, from_unixtime(MAX(time),'yyyy-MM-dd' ) AS latest_login
FROM login
GROUP BY v['uid']
) t1
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
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

@andsens
andsens / bootstrap_homeshick.sh
Last active December 13, 2024 17:55
Script that can set up an entire user account with homeshick automatically
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'
@swannodette
swannodette / example-user.clj
Created May 4, 2012 11:39 — forked from nijikokun/example-user.js
Beautiful Validation... Why have I never thought of this before?!
(defn validates-credentials [username password]
(let [uc (count username)
pc (count password)]
(match [username uc password pc]
[(:or nil "") _ _ _] {:error "No username given" :field "name"}
[_ _ (:or nil "") _] {:error "No password given" :field "pass"}
[_ (_ :guard #(< % 3)) _ _] {:error "Username less than 3 characters" :field "pass"}
[_ _ _ (_ :guard #(< % 4))] {:error "Password less than 4 characters" :field "pass"}
[#"^([a-z0-9-_]+)$" _ _ _] {:error "Username contains invalid characters" :field "name"}
:else true)))
@wickman
wickman / README.md
Created April 12, 2012 22:55
Python development in Pants (tutorial)

Python development using Pants

brian wickman - @wickman

[TOC]

Why use Pants for Python development?

Pants makes the manipulation and distribution of hermetically sealed Python environments

@fetep
fetep / genhttplogs.rb
Created March 14, 2012 15:32
apache log generator
#!/usr/bin/ruby
class IPGenerator
public
def initialize(session_count, session_length)
@session_count = session_count
@session_length = session_length
@sessions = {}
end
@kencoba
kencoba / Decorator.scala
Created February 21, 2012 11:27
Decorator pattern (Design Patterns in Scala)
// http://en.wikipedia.org/wiki/Decorator_pattern
trait Coffee {
def cost:Double
def ingredients: String
}
class SimpleCoffee extends Coffee {
override def cost = 1
override def ingredients = "Coffee"
@mbbx6spp
mbbx6spp / README.md
Created December 4, 2011 04:24
Best UNIX shell-based tools I can't live without with example usages

Best UNIX Shell tools

These are a list of usages of shell commands I can't live without on UNIX-based systems.

Install

Mac OS X

Using Homebrew (yes, I am opinionated) you can install the following tools with the following packages: