Skip to content

Instantly share code, notes, and snippets.

View kilfu0701's full-sized avatar

kilfu0701 kilfu0701

  • Trend Micro
  • Japan & Taiwan
View GitHub Profile
@kilfu0701
kilfu0701 / ruby.2.5.3-setup.sh
Created February 14, 2019 03:13 — forked from mustafaturan/ruby.2.6.3-setup.sh
ruby 2.5.3 setup for centos 6.x
#!/usr/bin/env bash
# repository
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
# system update
yum -y update
yum -y groupinstall "Development Tools"
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick
@kilfu0701
kilfu0701 / es_cmd_lists.md
Created February 14, 2019 02:11
Some useful commands for ElasticSearch.
  • Show status
curl 'localhost:9200/_cat/indices?v'
  • Show indexes
curl -XGET localhost:9200/_alias?pretty
@kilfu0701
kilfu0701 / get_aws_instance_private_ip.sh
Created February 12, 2019 01:13
get private IP address by aws instance id
aws ec2 describe-instances --output json --region ap-northeast-1 --instance-ids i-YYYYYY | \
python -c "
import sys;
import json;
print(json.loads(sys.stdin.read())['Reservations'][0]['Instances'][0]['PrivateIpAddress'])
"
@kilfu0701
kilfu0701 / create_swapfile.sh
Created February 8, 2019 03:51
centos 7 create swapfile
dd if=/dev/zero of=/swapfile count=4096 bs=1MiB
mkswap /swapfile
swapon /swapfile
# vi /etc/fstab
/swapfile swap swap defaults 0 0
@kilfu0701
kilfu0701 / ffmpeg_convert.sh
Created January 22, 2019 06:59
ffmpeg convert
# from mov to mp4
ffmpeg -i フラミンゴ.mov -s 1280x720 -b:v 4000k -vcodec libx264 -acodec aac -pix_fmt yuv420p flamingo.mp4
@kilfu0701
kilfu0701 / quick_setup.sh
Last active February 21, 2019 02:52
CentOS quick setup
##
yum groupinstall "Development tools"
## set system timezone
timedatectl set-timezone Asia/Tokyo
## date sync
yum install -y ntp
chkconfig ntpd on
ntpdate pool.ntp.org
@kilfu0701
kilfu0701 / cmd.sh
Created January 10, 2019 02:47
CentOS 5 with gcc 4.8
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
hash -r
gcc --version
@kilfu0701
kilfu0701 / calculate_scroll_percentage.js
Created November 26, 2018 08:54
Calculate the scroller percentage in html page.
// you can paste this code into chrome console, then check the result.
const pageHeight = (function () {
return Math.max(
document.body.scrollHeight,
document.documentElement.scrollHeight,
document.body.offsetHeight,
document.documentElement.offsetHeight,
document.body.clientHeight,
document.documentElement.clientHeight
);
  1. Dockerfile
FROM ubuntu:18.04
LABEL Maintainer="BoRu Su <[email protected]>"

RUN apt-get update \
  && apt-get install -y python3-pip python3-dev \
  && cd /usr/local/bin \
  && ln -s /usr/bin/python3 python \
 &amp;&amp; pip3 install --upgrade pip
@kilfu0701
kilfu0701 / linux_commands.md
Created October 26, 2018 04:57
linux commands