This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
aws iam list-groups | jq '.Groups[].GroupName' | xargs -I{} echo {} | \ | |
while read g | |
do | |
echo ${g} "-------------------------------------------------------------"; | |
aws iam get-group --group-name ${g} | jq '(.Group | {GroupName, Arn}), (.Users[] | {UserName, Arn})' | |
aws iam list-group-policies --group-name ${g} | jq '.PolicyNames[]' | xargs -I{} echo {} | \ | |
while read p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls -nd /home/* | sort -n -k 3,3 | awk '{ print $NF }' | while read user | |
do | |
echo ${user} | |
cat ${user}/.ssh/authorized_keys | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./configure --prefix=/usr/local/etc/nginx --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-cc-opt='-O2 -g -m64 -mtune=generic' --with-http_stub_status_module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Xvfb | |
# | |
# chkconfig: - 90 30 | |
# description: Xvfb | |
# Source function library. | |
. /etc/init.d/functions | |
lockfile="/var/lock/subsys/xvfb" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 9 * * * root /sbin/swapoff -a && /root/bin/mkswap.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# USAGE1: | |
# User.find(1).deepcache.friends.count.fetch | |
# | |
# 上記のような呼び出しをすると以下のキーで Redis に問い合わせてなければキャッシュします。 | |
# get deepcache:User:1:friends.count | |
# | |
# USAGE2: | |
# Category.deepcache.co_cats.where(slug: URI.encode(request_manager.params['slug'] || '')).limit(1).to_a.fetch | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Micropost < ApplicationRecord | |
belongs_to :user | |
before_save { self.in_reply_to = reply_user } | |
default_scope -> { order(created_at: :desc) } | |
mount_uploader :picture, PictureUploader | |
validates :user_id, presence: true | |
validates :content, presence: true, length: { maximum: 140 } | |
validate :picture_size | |
scope :including_replies, ->(user) { where("user_id = ? OR (user_id IN (SELECT followed_id FROM relationships WHERE follower_id = ?) AND (in_reply_to = ? OR in_reply_to LIKE ?))", user.id, user.id, "", "%@#{user.id}\-#{user.name.sub(/\s/,'-').downcase}%" ) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; package --- Summary | |
;;; Commentary: | |
;;; Code: | |
(when (require 'helm-config nil t) | |
(helm-mode 1) | |
(global-set-key (kbd "M-x") #'helm-M-x) | |
(global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks) | |
(global-set-key (kbd "C-x C-f") #'helm-find-files) | |
(global-set-key (kbd "C-x b") #'helm-mini) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "Personal rules @motchang", | |
"rules": [ | |
{ | |
"description": "左 Option を単体で押した時に英数キーにする", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "left_option", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'set' | |
require 'benchmark' | |
Benchmark.bm 10 do |r| | |
limit = 65535*1000 | |
r.report "to_a" do | |
(1..limit).to_a | |
end | |
r.report "to_set" do | |
(1..limit).to_set |
OlderNewer