Skip to content

Instantly share code, notes, and snippets.

View d-shimizu's full-sized avatar

Daisuke Shimizu d-shimizu

View GitHub Profile
@d-shimizu
d-shimizu / Get_vmem_test.c
Last active September 21, 2018 02:57
malloc()でLinuxの仮想メモリ空間のメモリ確保をし続けるだけのプログラム ref: http://qiita.com/d_shimizu/items/700e2eaf7408e7bc7a4c
#include <stdio.h>
#include <stdlib.h>
int main() {
char *p;
unsigned long i = 1073741824;
// 文字列変数に1GB(1073741824 B)のメモリを確保し続ける
// メモリを確保できなくなるとmallocはnullを返すため、nullが返されるまで繰り返す
do {
@d-shimizu
d-shimizu / ruby-cpu_1core-full_usage02
Last active September 21, 2018 02:57
Rubyを使ってCPU1コアの使用率を100%にするためのワンライナー ref: http://qiita.com/d_shimizu/items/1864e29e15b179eb0e54
ruby -e loop{}
@d-shimizu
d-shimizu / ruby-cpu_1core-full_usage01
Last active September 21, 2018 02:56
RubyワンライナーでCPU1コアの使用率を100%にする ref: http://qiita.com/d_shimizu/items/43b436fd149ec772eb87
% ruby -e 'while (1); end'
@d-shimizu
d-shimizu / Twitter_KeywordSearch.rb
Last active September 18, 2019 11:32
Twitter Ruby Gemを使って、RubyでTwitterキーワード検索を試す ref: http://qiita.com/d_shimizu/items/05e42ba15cd13e45cfca
#!/bin/env ruby
#encoding:UTF-8
require "twitter"
# アプリケーションキー(consumer key/secret)の読み込み
Twitter.configure do |cnf|
cnf.consumer_key = "XXXX"
cnf.consumer_secret = "XXXX"
end
@d-shimizu
d-shimizu / FizzBuzz01.sh
Last active September 21, 2018 02:56
シェルスクリプトでFizzBuzzワンライナー ref: https://qiita.com/d_shimizu/items/dfd5d521e2c2a5fe5e4e
$ jot 100 | awk '$1%3==0&&$1%15!=0{print "Fizz"} $1%5==0&&$1%15!=0{print "Buzz"} $1%15==0 {print "FizzBuzz"} $1%3!=0&&$1%5!=0{print $1 }' | tr ' ' '\n'