Skip to content

Instantly share code, notes, and snippets.

View kphrx's full-sized avatar

kPherox kphrx

View GitHub Profile
#!/bin/sh
abort () {
echo "Aborted."
exit 1
}
echo "Ctrl-D to continue, Ctrl-C to abort."
trap abort 2
#!/bin/sh
echo -n "Default yes [Y/n]: "
read y
if [[ "${y:0:1}" == [nN] ]]; then
echo "Answer no."
exit 1
fi
#!/bin/sh
if [ "$(whoami)" != "root" ]; then
exit 126
fi
#!/bin/sh
# Nginx
NGINX_LATEST_VER=$(curl -sL https://nginx.org/en/CHANGES | grep 'Changes' | head -n1 | awk '{print $4}')
curl --progress-bar -L http://nginx.org/download/nginx-${NGINX_LATEST_VER}.tar.gz | tar xz
# PHP
PHP_LATEST_VER=$(curl -sL https://www.php.net/releases/feed.php | awk '/entry/,/\/entry/' | tr '\n' ' ' | awk '{ print $3 }')
curl --progress-bar -L http://jp2.php.net/get/php-${PHP_LATEST_VER}.tar.xz/from/this/mirror | tar xJ
@kphrx
kphrx / rolling-update.sh
Last active June 29, 2021 14:09
docker container rolling update script with docker-compose. service name: "web"
#!/bin/sh
OLD_CONTAINER=$(docker ps --all --format "{{.Names}}" --filter name=web)
docker-compose pull web
docker-compose up -d --no-deps --scale web=2 --no-recreate web
NEW_CONTAINER=$(docker ps --all --format "{{.Names}}" --filter name=web | grep -v "$OLD_CONTAINER")
echo -n "Starting $NEW_CONTAINER ... "
@kphrx
kphrx / backquote-glyph-class-change.pe
Created October 8, 2019 09:41
backquote-glyph-class-change.pe /path/to/font.ttf
#!/usr/local/bin/fontforge
i=1
while ( i<$argc )
Open($argv[i])
Print($argv[i])
Select("`")
beforeClass = GlyphInfo("Class")
SetGlyphClass("base")

update-pleroma

systemd timer unitで定期的に実行させる形 /opt/pleromaにpleromaをcloneしておく。その時upstreamを設定する

  1. dotenv.exmapledotenvにコピーして適宜変更
  2. update-pleroma.service/path/todotenvupdate-pleroma.shの置いてあるパスに向ける
  3. update-pleroma.serviceupdate-pleroma.timerをsystemdの管理下へ置いてsystemctl start update-pleroma.timerを実行

Keybase proof

I hereby claim:

  • I am kphrx on github.
  • I am kpherox (https://keybase.io/kpherox) on keybase.
  • I have a public key whose fingerprint is 55A2 8362 FE57 05D3 FF27 0136 C047 51C2 BFA2 F62D

To claim this, I am signing this object:

@kphrx
kphrx / delete_of_map_image_2nd.sql
Last active August 20, 2019 11:13
MyFleetGirls Delete Old Version Resources
DELETE FROM map_image_2nd
WHERE EXISTS (
SELECT 1
FROM map_image_2nd AS m
WHERE map_image_2nd.area_id = m.area_id
AND map_image_2nd.info_no = m.info_no
AND map_image_2nd.suffix = m.suffix
AND map_image_2nd.version < m.version
);
@kphrx
kphrx / jump-to-game-of-kancolle.user.js
Last active March 23, 2022 17:27
Install from raw
// ==UserScript==
// @name Set scroll position to game of KanColle
// @namespace https://gist.github.com/kPherox
// @version 1.1.1
// @description Jump to game frame top of KanColle.
// @author kPherox <[email protected]>
// @match http://www.dmm.com/netgame/social/-/gadgets/=/app_id=854854*
// @run-at document-end
// @grant GM_addStyle
// @updateURL https://gist.github.com/kphrx/fb4f21c1bbfa6bcbb484c74824866e65/raw/jump-to-game-of-kancolle.user.js