Skip to content

Instantly share code, notes, and snippets.

View rita-liu's full-sized avatar

Rita Liu rita-liu

View GitHub Profile
@rita-liu
rita-liu / redis_cheatsheet.bash
Created March 31, 2020 03:02 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@rita-liu
rita-liu / gist:c42f5c067572b5d8309e69f82074c2e9
Created September 17, 2019 08:43 — forked from 3socha/gist:0e7198d8f8da897afac65878f84f53a6
AWS Pricing API ワンライナー
$ aws pricing describe-services \
  --region us-east-1 \
| jq -r '.Services[] | select (.ServiceCode=="AmazonEC2") | .AttributeNames[]' \
| sort
LeaseContractLength
OfferingClass
PurchaseOption
capacitystatus
clockSpeed
@rita-liu
rita-liu / rds_ri_prices_parser.rb
Created September 17, 2019 04:14 — forked from shinsaka/rds_ri_prices_parser.rb
AWS RDS RI pricing parser
#!/usr/bin/env ruby
require 'json'
def parse(uri)
JSON.parse `curl -s #{uri}`.gsub(/\/\*(?:(?!\*\/).)*\*\//m, '').strip.gsub(/^callback\(/, '').gsub(/\);/, '').gsub(/([a-zA-Z]+[0-9]*):/, '"\1":')
end
puts %w(
platform
#!/usr/bin/env bash
URL="http://a0.awsstatic.com/pricing/1/ec2/ri-v2/linux-unix-shared.min.js"
echo -e "1S- = Std 1 Year Term \t3S- = Std 3 Year Term\t3C- = Convertibe 3 Year Term"
echo -e " -NON = No Up Front Cost\t -PRT = Partially Upfront\t -ALL = Entire Term Upfront"
echo ""
echo -e "Instance\tONDMND\t1S-NON\t1S-PRT\t1S-ALL\t3S-PRT\t3S-ALL\t3C-NON\t3C-PRT\t3C-ALL\n"
(echo 'function callback(data) { console.log(JSON.stringify(data)); }'; curl -s "$URL" ) |\
@rita-liu
rita-liu / bench-memcached.php
Created August 9, 2019 02:45 — forked from herewithme/bench-memcached.php
Benchmark for test memcached performance
<?php
// Initialize values: 1000000 keys of 20 bytes with 40 bytes of data
$c = 1000000;
$values = array();
for ($i=0;$i<$c;$i++) $values[sprintf('%020s',$i)]=sha1($i);
// Memcached
$m = new Memcached();
$m->addServer('10.0.101.82', 11211);
$start = microtime(true);