Skip to content

Instantly share code, notes, and snippets.

Avatar
I may be slow to respond.

anon anon5r

I may be slow to respond.
View GitHub Profile
@anon5r
anon5r / anti_japanese_featurephone.conf
Last active Aug 29, 2015
ガラケー対応はこのApacheの設定だけで充分!
View anti_japanese_featurephone.conf
BrowserMatch "^DoCoMo/[1-2]\.0" Browser_FP=1
BrowserMatch "^UP\.Browser/[1-9]\.[0-9]" Browser_FP=1
BrowserMatch "^KDDI-[A-Z0-9]+ UP\.Browser/[1-9]\.[0-9]" Browser_FP=1
BrowserMatch "^J-PHONE/1\.0" Browser_FP=1
BrowserMatch "^Vodafone/[1-2]\.0" Browser_FP=1
BrowserMatch "^SoftBank/[1-9]\.0" Browser_FP=1
<If Browser_FP>
RewriteEngine On
RewriteRule /* /unsupported.html [L]
</If>
View iOS App Store Crawler
#!/usr/bin/env ruby
# iOS App Store Crawler by Nowa <nowazhu@gmail.com>
# 2010-08-04
require 'rubygems'
require 'hpricot'
require 'open-uri'
USERAGENT = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4'
LETTERS = %w{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z *}
@anon5r
anon5r / nginx.conf
Last active Aug 29, 2015
Can not be browsing safety internet using Windows XP.
View nginx.conf
server {
set $browse_os "";
if ($uri !~ ^/support_for_windows_xp_has_ended){
set $browse_os "X";
}
if ($http_user_agent ~ "Windows NT 5\.[12]") {
set $browse_os "${browse_os}P";
}
if ($browse_os = "XP"){
return 302 /support_for_windows_xp_has_ended;
@anon5r
anon5r / randomString.js
Created Nov 27, 2014
Random strings generator
View randomString.js
function randomString(length,numNumeric,numLCase,numUCase,numSymbols){
length=length||16;numNumeric=numNumeric||3,numLCase=numLCase||3,numUCase=numUCase||3,numSymbols=numSymbols||3;
var charsList = [
'0123456789',
'abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'!"#$%&\'()*+,-./\\:;<=>?@[]^_`{|}~'
],
charLength = [numNumeric,numLCase,numUCase,numSymbols],
str="",i=0;
View 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 Aug 7, 2012
Start Daemon for Apache Solr Searcher
View solr-searcher.sh
#!/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 Aug 23, 2012
Show latest log for nginx (access.log or error.log)
View latestlog.sh
#!/bin/sh
#
# args[1] : hostname
# args[2] : access | error
# args[3] : date[yyyy/mm]
#
filehost="*"
filetype="access"
View rotate_backup.sh
#!/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 Mar 4, 2013
グラフィックソフトの透過背景を表すのに使われるチェック柄(市松模様)のアレをCSSだけで再現する
View transparent_checker.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 / gitlab_update.sh
Last active Dec 17, 2015
GitLab Auto Updater
View gitlab_update.sh
#!/bin/sh
BRANCH=master
if [ $# -ge 1 ]; then
BRANCH=$1
fi
if [ "$SUDO_USER" != "" ] && [ "$SUDO_USER" != "git" ]; then
echo 'You are not user "git".'