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
NSString* pattern = @"^(\\d{3})$"; | |
NSError* error = nil; | |
NSRegularExpression* regex = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive error:&error]; | |
NSString* text = @"122"; | |
NSArray *matches = [regex matchesInString:text options:0 range:NSMakeRange(0, text.length)]; | |
if(matches.count>0){ | |
NSLog(@"%@",matches); | |
}else{ |
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
## get instance_id | |
instance_id=$(curl http://169.254.169.254/latest/meta-data/instance-id) | |
## get Name Tag | |
instance_name=$(aws ec2 describe-instances --instance-ids ${instance_id} \ | |
--query 'Reservations[*].Instances[*].Tags[?Key==`Name`].Value' \ | |
--output text) | |
echo $instance_name |
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
[core] | |
editor = vim -c \"set fenc=utf-8\" | |
[alias] | |
ctree = log --color --graph --date-order --pretty=format:'%x09%C(yellow)%h%Creset%x09%C(red)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
tree = log --color --graph --date-order --all --pretty=format:'%x09%C(yellow)%h%Creset%x09%C(red)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
ck = checkout | |
pff = pull --ff-only | |
prebase = pull --rebase | |
fprune = fetch --prune | |
prbdev = pull --rebase origin develop |
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
<style type="text/css"> | |
#json { | |
height: 320px; | |
overflow: scroll; | |
border:1px solid #ddd; | |
padding:10px; | |
} | |
</style> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Ansi 0 Color</key> | |
<dict> | |
<key>Blue Component</key> | |
<real>0.48771023750305176</real> | |
<key>Green Component</key> | |
<real>0.48781105875968933</real> |
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 JsonParser | |
options no_result_var | |
rule | |
json_text : ws object ws | |
{ val[1] } | |
| ws array ws | |
{ val[1] } | |
ws : | |
| ws SPACE |
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 'bundler/setup' | |
Bundler.require | |
module Faraday | |
class Dummy < Faraday::Middleware | |
def call(env) | |
if Random.new.rand(0..1) == 0 | |
@app.call(env).on_complete do |env| | |
env | |
end |
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 'pry' | |
CODES = ('A'..'Z') | |
CODES_SIZE = CODES.to_a.size | |
def index2code(n) | |
num = n | |
chars = [] | |
codes = CODES.to_a | |
begin |
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 'bundler/setup' | |
require 'google_drive' | |
require 'json' | |
sheet_id = ENV['SHEET_ID'] | |
json_file = ENV['AUTH_JSON'] | |
options = JSON.parse(File.read(json_file)) | |
key = OpenSSL::PKey::RSA.new(options['private_key']) |
OlderNewer