フロントエンドを楽にするために
Qiitaを支えたい技術 at 時雨祭
- HN: mizchi
- Qiitaの方からきました(入社半年たったらしい)
- Reactオジサンはそろそろ飽きてきた
- Angularに興味が無いのでこっちにきた
| Perl ワンライナーサンプル集 | |
| ■概要 | |
| 障害解析のためのログの調査、非互換対応でのソースコードの調査といった | |
| テキスト処理で使った Perl ワンライナーのサンプル集です。 | |
| Perl ワンライナーは以下の点が良いと思います。 | |
| ・Perl は Oracle Database (10g以降) に同梱されている。 | |
| 従って、Windows プラットフォームでも使える。 |
| #!/bin/bash | |
| # Get current swap usage for all running processes | |
| # Erik Ljungstrom 27/05/2011 | |
| # Updated: 2013-11-13 Yuichiro Saito | |
| SUM=0 | |
| OVERALL=0 | |
| for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do | |
| PID=`echo $DIR | cut -d / -f 3` | |
| PROGNAME=`ps -p $PID -o comm --no-headers` | |
| for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'` |
-- テーブルを作る
CREATE TABLE t (
user_id int unsigned not null,
score int not null,
ranking int unsigned, -- rankingというカラムがエンジンによって自動更新される
primary key (user_id),
key ranking (score) -- ランキング用のindex
) engine=ranking;
| namespace :db do | |
| require "sequel" | |
| Sequel.extension :migration | |
| DB = Sequel.connect(ENV['DATABASE_URL']) | |
| desc "Prints current schema version" | |
| task :version do | |
| version = if DB.tables.include?(:schema_info) | |
| DB[:schema_info].first[:version] | |
| end || 0 |
| #!/bin/bash | |
| # | |
| # Example of how to parse short/long options with 'getopt' | |
| # | |
| OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"` | |
| if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi | |
| echo "$OPTS" |
| module Where | |
| class <<self | |
| attr_accessor :editor | |
| def is_proc(proc) | |
| source_location(proc) | |
| end | |
| def is_method(klass, method_name) | |
| source_location(klass.method(method_name)) |
| # Colorizes the output of the standard library logger, depending on the logger level: | |
| # To adjust the colors, look at Logger::Colors::SCHEMA and Logger::Colors::constants | |
| require 'logger' | |
| class Logger | |
| module Colors | |
| VERSION = '1.0.0' | |
| NOTHING = '0;0' |