Skip to content

Instantly share code, notes, and snippets.

View anon5r's full-sized avatar

anon anon5r

View GitHub Profile
@anon5r
anon5r / gitlab-psql.sh
Created March 25, 2016 01:30
To control PostgreSQL with SQL queries in GitLab omnibus docker image
#!/bin/sh
#sudo docker exec -it gitlab /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -U gitlab -d gitlabhq_production
sudo docker exec -it gitlab sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql --port 5432 -h /var/opt/gitlab/postgresql -d gitlabhq_production
psql
@anon5r
anon5r / 山手線駅名名字.txt
Created April 6, 2016 09:53
JR山手線の駅名と同じあるいは類似する日本人の実在する名字
池袋
大塚
巣鴨
駒込
田端
日暮
上野
秋葉
神田
東京
@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=" ";
@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 / 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 / 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
print "今日も一日がんばるびぃ!\n"

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:

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:

@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 {