$ brew install pyenv
This file contains hidden or 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
| for tuple r in R: | |
| for tuple s in S: | |
| emit, if r and s match |
This file contains hidden or 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
| import pandas as pd | |
| file_path = 'your-file-path' | |
| df = pd.read_csv(file_path) | |
| df['code_snippet'] = df['content'].str.find('\n```\n') > 0 | |
| pattern = r'!\[.*\]\(.*\)' | |
| df['image'] = df['content'].str.contains(pattern) |
This file contains hidden or 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
| console.log(i); // Because we assign value to `i` after this line, it will print `undefined`. | |
| //I like extract the max number as a variable, for example `var max = 100` | |
| for (var i = 1; i <= 100; i++) { | |
| var check = true; | |
| // I don't understand the logic here? | |
| for (var j= 2; j <=6; j++) { | |
| if(i%j ==0) { | |
| check =false; | |
| } | |
| } |
This file contains hidden or 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
| function foo() { | |
| var i = 0; | |
| while (i < 10000000) { | |
| i = i + 1; | |
| if (i % 3000000 === 0) { | |
| } | |
| } | |
| return i; | |
| } |
This file contains hidden or 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
| # Basic Uage of Pandas | |
| ## 讀取資料 | |
| ```py | |
| df = pd.read_csv('olympics.csv', index_col = 0, skiprows = 1) | |
| ``` | |
| ## 選擇與過濾資料 | |
| ```py | |
| # 回傳第一筆資料 |
This document will explain how to install
querycsv, a tool to help you query csv file using sql.
#open terminal
$ which brew
# if console output `brew not found`, install homebrew first, else skip this command
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
This file contains hidden or 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
| namespace :sitemap do | |
| desc "unzip sitemap.xml.gz and upload to s3" | |
| task upload: :environment do | |
| gz_file_path=Rails.root.join('public', 'sitemap.xml.gz') | |
| file_path=Rails.root.join('public', 'sitemap.xml') | |
| Zlib::GzipReader.open(gz_file_path) do |gz| | |
| File.open(file_path, 'w') { |file| file.write(gz.read) } | |
| end | |
| upload_to_s3 | |
| end |
This file contains hidden or 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 Book < ActiveRecord::Base | |
| def self.search(options) | |
| # implement your search | |
| end | |
| end | |
| class BooksController < ApplicationController | |
| def search | |
| options=params[:keyword] | |
| @books=Book.search(options) |
This file contains hidden or 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
| var AWS = require('aws-sdk'); | |
| var autoscaling = new AWS.AutoScaling(); | |
| var ec2 = new AWS.EC2(); | |
| var AutoScalingGroupNames = ['your-asg-name']; | |
| autoscaling.describeAutoScalingGroups({ | |
| AutoScalingGroupNames: AutoScalingGroupNames | |
| }, function(err, data) { | |
| var instances = data.AutoScalingGroups[0].Instances; | |
| var instanceIds = instances.map(instance => instance.InstanceId); |
NewerOlder