Skip to content

Instantly share code, notes, and snippets.

View kphrx's full-sized avatar

kPherox kphrx

View GitHub Profile
@kphrx
kphrx / NowPlayingTweet.scpt
Last active December 24, 2017 13:44
#NowPlaying tweet by TwitterScripter
on NPSaveAsPICT(theFile, theData)
try
set fh to open for access file theFile with write permission
write theData to fh
close access fh
on error errMsg number errNum
try
close access fh
end try
log {errNum, errMsg}
## www to non-www redirect ##
server {
## all www sub-domain ##
server_name ~^www\.(.*\.example.com)$;
## redirect to non-www sub-domain ##
return 301 $scheme://$1$request_uri;
}
## non-www to www redirect ##
server {
server_name *.hogehoge.com;
#if redirect hogehoge.com to www.hogehoge.com
#server_name .hogehoge.com;
return 301 $scheme://www.$host$request_uri;
}
#!/bin/bash
uriLinks="http://s3.feedly.com/img/follows/"
URL="feedly-follow-rectangle-volume-big_2x.png"\ "feedly-follow-rectangle-volume-medium_2x.png"\ "feedly-follow-rectangle-volume-small_2x.png"\ "feedly-follow-square-volume_2x.png"\ "feedly-follow-rectangle-flat-big_2x.png"\ "feedly-follow-rectangle-flat-medium_2x.png"\ "feedly-follow-rectangle-flat-small_2x.png"\ "feedly-follow-square-flat-green_2x.png"\ "feedly-follow-circle-flat-green_2x.png"\ "feedly-follow-logo-green_2x.png"\ "feedly-follow-square-flat-black_2x.png"\ "feedly-follow-circle-flat-black_2x.png"\ "feedly-follow-logo-black_2x.png"\ "feedly-follow-square-flat-white_2x.png"\ "feedly-follow-circle-flat-white_2x.png"\ "feedly-follow-logo-white_2x.png"
for url in $URL
do
wget $uriLinks$url
done
#!/bin/bash
CMDNAME=`basename $0`
while getopts v: OPT
do
case ${OPT} in
"v" ) FLR_v="TRUE"
NGXVER="${OPTARG}"
;;
#!/bin/bash
####################
# #
# (C) 2015 kPherox #
# #
####################
CMDNAME=`basename $0`
@kphrx
kphrx / passcreate
Last active January 31, 2017 17:01
#!/bin/bash
##################
# #
# © 2015 kPherox #
# #
##################
CMDNAME=`basename $0`
CAT="cat /dev/urandom"
# coding: utf-8
import sys
import os
import itertools
import pypuzzle
from glob import glob
puzzle = pypuzzle.Puzzle()
#!/bin/bash
DIR=`pwd`
JPEG="-name '*.jpg' -o -name '*.jpeg'"
PNG="-name '*.png' -o -name '*.gif'"
OPTIJPG="jpegoptim --strip-all --max=80"
OPTIPNG="optipng -strip all -o7"
find ${DIR} -print0 ${JPEG} | xargs -0 ${OPTIJPG}
@kphrx
kphrx / VersionSort.php
Last active January 19, 2018 08:58
version list sort
<?php
class VersionSort {
public static function ascendingSort(array &$versionArray) {
return usort($versionArray, 'self::ascendingCompare');
}
public static function descendingSort(array &$versionArray) {
return usort($versionArray, 'self::descendingCompare');
}