Skip to content

Instantly share code, notes, and snippets.

View anon5r's full-sized avatar

anon anon5r

View GitHub Profile
@anon5r
anon5r / letsencrypt.conf
Created June 30, 2017 09:43
Let's Encrypt common config file for nginx
location ^~ /.well-known/acme-challenge/ {
root /var/www/letsencrypt;
}
location = /.well-known/acme-challenge/ {
return 404;
}
@anon5r
anon5r / mastodon-update.sh
Created May 29, 2017 01:45
マストドンのシンプルなアップデート手順。主にさくらのクラウドのスタートアップスクリプトを利用してインストールした場合を想定しています。
#!/bin/sh
# 無難な対応としては、最初にmastodonを一度停止した方が良いので停止する。
# systemctl stop mastodon-{web,sidekiq,stream}
# mastodonユーザー出ない場合は下記のコマンドでmastodonユーザーになる
# 一般ユーザーからの場合
# sudo su - mastodon
@anon5r
anon5r / XmlSample.java
Created April 23, 2017 14:52
アプリのリソースファイル内に置いたXMLファイルをパースして使用するときのサンプル
package net.anoncom.android.example;
import java.io.IOException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.content.res.Resources;
import android.util.Log;
public class XmlSample {

Keybase proof

I hereby claim:

  • I am anon5r on github.
  • I am fujimoto (https://keybase.io/fujimoto) on keybase.
  • I have a public key whose fingerprint is 1C02 8A68 60C4 E654 4CED E017 FF88 E49C 9EB7 87A4

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am anon5r on github.
  • I am anon5r (https://keybase.io/anon5r) on keybase.
  • I have a public key ASA1ZBc2tRYf-wGjKFM7Gg0zqbH40SMEYhgX-waxoD9FtQo

To claim this, I am signing this object:

print "今日も一日がんばるびぃ!\n"
@anon5r
anon5r / is_alive_host.php
Last active October 10, 2016 08:35
$hostname の $port が接続先としてコネクション応答出来る状態かを確認します。
<?php
/**
* $hostname が接続先として接続応答出来る状態かを確認します。
*
* @access public
* @static
* @param string $hostname 接続先ホスト名またはIP
* @param int $port 接続先ポート番号
* @param int $timeout タイムアウトを指定する(秒)
* @return boolean
@anon5r
anon5r / progressbar.js
Last active August 16, 2019 22:18
コマンドラインでの進捗状況(プログレスバー)を表示するやつ(Node.JS)
// Pad string to right
String.prototype.pad=function(len,str){
if(typeof str=="undefined") str=" ";
if(this.length>len) return this.toString();
str=str.repeat(len-this.length);
return (this+str).substr(0,len);
}
// Pad string to left
String.prototype.lpad=function(len,str){
if(typeof str=="undefined") str=" ";
@anon5r
anon5r / progressbar.php
Last active August 16, 2019 22:18
コマンドラインでの進捗状況(プログレスバー)を表示する(PHP)
<?php
// 回転するやつ /-\|
$c=['|','/','-','\\'];
// like GCP
//$c=['⣤','⣆','⡇','⠏','⠛','⠹','⢸','⣰'];
$ci = count($c);
for($i=0;$i<=100;$i++){
echo "\r"; // 描画カーソルを行頭に戻す
$block=str_repeat('#',floor($i/5));
printf('Processing... %s [%-20s]%3d%%', $c[$i%$ci], $block, $i);
@anon5r
anon5r / string_pad.js
Last active April 11, 2016 05:14
Padding string fixed length
// Pad string to right
String.prototype.pad=function(len,str){
if(typeof str=="undefined") str=" ";
if(this.length>len) return this.toString();
str=str.repeat(len-this.length);
return (this+str).substr(0,len);
}
// Pad string to left
String.prototype.lpad=function(len,str){
if(typeof str=="undefined") str=" ";