Skip to content

Instantly share code, notes, and snippets.

View anon5r's full-sized avatar
🏠
Working from home

anon anon5r

🏠
Working from home
View GitHub Profile
@anon5r
anon5r / patchwork.py
Created February 25, 2010 03:38 — forked from oquno/patchwork.py
def create_cell():
cell =[]
for line in open('p.txt', 'r'):
line = list(line.rstrip())
cell.append(line)
return cell
def chaise(cell, x, y):
if cell[x][y] == 'c':
return False
@anon5r
anon5r / solr-searcher.sh
Created August 7, 2012 06:55
Start Daemon for Apache Solr Searcher
#!/bin/sh
#
# chkconfig: - 90 20
# description: apache-solr
#
if [ -f /etc/rc.d/init.d/functions ]; then
# Source function library.
. /etc/rc.d/init.d/functions
elif [ -f /etc/rc.status ]; then
@anon5r
anon5r / latestlog.sh
Created August 23, 2012 10:42
Show latest log for nginx (access.log or error.log)
#!/bin/sh
#
# args[1] : hostname
# args[2] : access | error
# args[3] : date[yyyy/mm]
#
filehost="*"
filetype="access"
@anon5r
anon5r / ReadonlyProperties.php
Created October 9, 2012 06:02
コンストラクタの引数に渡された連想配列のキーをプロパティ名、値をプロパティの値として保持するオブジェクトを生成できるようにする
<?php
class ReadonlyProperties {
private $__props = array();
public function __construct( array $params ) {
$this->__props = $params;
}
public function __get( $_name ) {
@anon5r
anon5r / iOS絵文字抽出用正規表現
Last active October 11, 2018 02:33
iOSで扱われるUnicode 6.0絵文字の判定をする正規表現
# 実際の利用時には、途中の改行、および # で始まるコメント行は削除してね
/(?:
# 合成文字系
# 数値
(?:(?:\x0023|[\x0030-x0039])\x20E3)|
# 国旗
(?:\x1F1E8\x1F1F3|\x1F1E9\x1F1EA|\x1F1EA\x1F1F8|\x1F1EB\x1F1F7|\x1F1EC\x1F1E7|\x1F1EE\x1F1F9|\x1F1EF\x1F1F5|\x1F1F0\x1F1F7|\x1F1F7\x1F1FA|\x1F1FA\x1F1F8)|
# 合成文字ここまで
# 以下単体文字(絵文字)
(?:\x00A9|\x00AE|\x2002|\x2003|\x2005|\x203C|\x2049|\x2122|\x2139|[\x2194-x2199]|\x21A9|\x21AA|\x231A|\x231B|\x23E9|\x23EA|\x23EB|\x23EC|\x23F0|\x23F3|\x24C2|\x25AA|\x25AB|\x25B6|\x25C0|\x25FB|\x25FC|\x25FD|\x25FE|\x2600|\x2601|\x260E|\x2611|\x2614|\x2615|\x261D|\x263A|\x2648|\x2649|\x264A|\x264B|\x264C|\x264D|\x264E|\x264F|\x2650|\x2651|\x2652|\x2653|\x2660|\x2663|\x2665|\x2666|\x2668|\x267B|\x267F|\x2693|\x26A0|\x26A1|\x26AA|\x26AB|\x26BD|\x26BE|\x26C4|\x26C5|\x26CE|\x26D4|\x26EA|\x26F2|\x26F3|\x26F5|\x26FA|\x26FD|\x2702|\x2705|\x2708|\x2709|\x270A|\x270B|\x270C|\x270F|\x2712|\x2714|\x2716|\x2728|\x2733|\x2734|\x2744|\x2747|\x274C|\x274E|\x2753|\x2754|\x2755|\x2757|\x2764|\x2795|\x2796|\x2797|\x27A1|\x27B0|\x2934|\x2935|\x2B05|\x2B0
#!/bin/bash
# for use with cron, eg:
# 0 3 * * * root /home/www/batch/bin/backup.sh /var/backup/www
if [[ -z "$1" ]]; then
echo "Usage: $0 <PATH>"
exit 1
fi
@anon5r
anon5r / transparent_checker.css
Created March 4, 2013 04:41
グラフィックソフトの透過背景を表すのに使われるチェック柄(市松模様)のアレをCSSだけで再現する
body {
margin: 0;
padding: 0;
background-color: #fff;
background-image: linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%, #ddd),
linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%, #ddd);
background-size: 18px 18px;
background-position: 0 0, 9px 9px;
overflow: hidden;
}
@anon5r
anon5r / daemon.sh
Last active February 3, 2018 13:02
Simple control daemons installed by homebrew running on OS X
#!/bin/sh
#VERSION_PHP="5.6"
VERSION_PHP="7.2"
function help(){
echo "ex: $0 <daemon> <command>"
echo
echo "Support daemons:"
echo "\tnginx\t\tnginx"
@anon5r
anon5r / gitlab_update.sh
Last active December 17, 2015 16:39
GitLab Auto Updater
#!/bin/sh
BRANCH=master
if [ $# -ge 1 ]; then
BRANCH=$1
fi
if [ "$SUDO_USER" != "" ] && [ "$SUDO_USER" != "git" ]; then
echo 'You are not user "git".'
@anon5r
anon5r / solr_admin_extend.user.js
Created January 9, 2014 02:40
Solr(<=1.x) admin page Sort field extended
// ==UserScript==
// @name Solr admin page Sort field extended
// @namespace net.anoncom.greasemonkey.
// @include http://*/solr/admin/form.jsp
// ==/UserScript==
// qq
//document.body.innerHTML = document.body.innerHTML.replace(/<td>\n*\s*<strong>Start Row<\/strong>\n\s*<\/td>\n/g, "<td><strong>qq</strong></td>\n<td><input type=\"text\" name=\"qq\" value=\"\" /></td>\n</tr>\n<tr>\n <td>\n\t<strong>Start Row</strong>\n </td>\n");