- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- They are the people who get things done. Effective Engineers produce results.
#!/usr/bin/python | |
import sys | |
import json | |
data = sys.stdin.read() | |
json_data = json.loads("".join(data)) | |
json_string = json.dumps(json_data, sort_keys=True, indent=4, ensure_ascii=False) | |
print(json_string) |
เนื้อหาอยู่ที่นี่ เย้ |
# An example of how to use AWS SNS with Python's boto | |
# By Stuart Myles @smyles | |
# http://aws.amazon.com/sns/ | |
# https://github.com/boto/boto | |
# | |
# Inspired by parts of the Ruby SWF SNS tutorial http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-sns-tutorial-implementing-activities-poller.html | |
# And the Python SNS code in http://blog.coredumped.org/2010/04/amazon-announces-simple-notification.html and http://awsadvent.tumblr.com/post/37531769345/simple-notification-service-sns | |
import boto.sns as sns | |
import json |
""" | |
How Not To Sort By Average Rating: | |
http://www.evanmiller.org/how-not-to-sort-by-average-rating.html | |
Note: Lower bound of a 95% confidence interval | |
""" | |
import math | |
import unittest | |
#!/usr/bin/env ruby | |
icon_list = "alligator, anteater, armadillo, auroch, axolotl, badger, bat, beaver, buffalo, camel, chameleon, cheetah, chipmunk, chinchilla, chupacabra, cormorant, coyote, crow, dingo, dinosaur, dolphin, duck, elephant, ferret, fox, frog, giraffe, gopher, grizzly, hedgehog, hippo, hyena, jackal, ibex, ifrit, iguana, koala, kraken, lemur, leopard, liger, llama, manatee, mink, monkey, narwhal, nyan cat, orangutan, otter, panda, penguin, platypus, python, pumpkin, quagga, rabbit, raccoon, rhino, sheep, shrew, skunk, slow loris, squirrel, turtle, walrus, wolf, wolverine, wombat" | |
for icon in icon_list.split ', ' do | |
element = icon.sub ' ', '' | |
`curl https://ssl.gstatic.com/docs/common/profile/#{element}_lg.png -o icons/#{element}.png` | |
end |
require 'rack/jekyll' | |
require "rack/rewrite" | |
use Rack::Auth::Basic, "Restricted Area" do |username, password| | |
[username, password] == ['admin', 'admin'] or [username, password] == ['zkan', '123'] or [username, password] == ['cory', 'cool'] | |
end | |
use Rack::Rewrite do | |
rewrite %r{/(.+)}, lambda { |match, rack_env| | |
if File.exists?('_site/' + match[1] + '.html') |
<?php | |
/* | |
* Plugin Name: WooCommerce Cart Count Shortcode | |
* Plugin URI: https://github.com/prontotools/woocommerce-cart-count-shortcode | |
* Description: Display a link to your shopping cart with the item count anywhere on your site with a customizable shortcode. | |
* Version: 1.0.4 | |
* Author: Pronto Tools | |
* Author URI: http://www.prontotools.io | |
* License: GNU General Public License v3.0 | |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html |
import csv | |
from faker import Faker | |
fake = Faker() | |
with open('transactions.csv', 'r') as file_: | |
with open('anonymized_transactions.csv', 'w') as new_file: | |
reader = csv.DictReader(file_) | |
writer = csv.DictWriter(new_file, fieldnames=reader.fieldnames) |
import random | |
import unittest | |
from unittest.mock import patch | |
class TryMockUsingDecoratorTest(unittest.TestCase): | |
@patch('__main__.random.randrange') | |
@patch('__main__.random.randint') | |
def test_mock_random_twice(self, mock_randint, mock_randrange): | |
try_mock_using_decorator() |