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
| // Documentation: https://github.com/beautify-web/js-beautify | |
| // Example URL: https://github.com/victorporof/Sublime-HTMLPrettify/blob/master/.jsbeautifyrc | |
| // Based on Airbnb's JavaScript Style Guide, URL: https://github.com/airbnb/javascript | |
| { | |
| // Collapse curly brackets | |
| "brace_style": "collapse", | |
| // Break chained method calls across subsequent lines | |
| "break_chained_methods": true, |
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
| # Your init script | |
| # | |
| # Atom will evaluate this file each time a new window is opened. It is run | |
| # after packages are loaded/activated and after the previous editor state | |
| # has been restored. | |
| # | |
| # An example hack to log to the console when each text editor is saved. | |
| # | |
| # atom.workspace.observeTextEditors (editor) -> | |
| # editor.onDidSave -> |
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
| 也忆江南 | |
| 江南春色能断肠 | |
| 烟雨空蒙应惆怅 | |
| 落英缤纷惜华年 | |
| 杨花扑面思故乡 |
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
| def md5(fname): | |
| hash_md5 = hashlib.md5() | |
| with open(fname, "rb") as f: | |
| for chunk in iter(lambda: f.read(4096), b""): | |
| hash_md5.update(chunk) | |
| return hash_md5.hexdigest() |
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
| To get both the process output and the returned code: | |
| from subprocess import Popen, PIPE | |
| p = Popen(["ls", "non existent"], stdout=PIPE) | |
| output = p.communicate()[0] | |
| print(p.returncode) | |
| subprocess.CalledProcessError is a class. To access returncode use the exception instance: | |
| from subprocess import CalledProcessError, check_output |
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
| # | |
| # Given the ID of an Amazon public AMI in one region, figure out what the | |
| # equivalent AMI IDs are for that same AMI in all other regions known. | |
| # If that AMI isn't defined in a region, it prints the region's name, but | |
| # comments it out. | |
| # | |
| from __future__ import print_function | |
| import boto3 |
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
| AWSTemplateFormatVersion: '2010-09-09' | |
| Resources: | |
| LambdaRole: | |
| Type: AWS::IAM::Role | |
| Properties: | |
| AssumeRolePolicyDocument: | |
| Version: '2012-10-17' | |
| Statement: | |
| - Effect: Allow | |
| Principal: |
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 boto3 | |
| def role_arn_to_session(**args): | |
| """ | |
| Usage : | |
| session = role_arn_to_session( | |
| RoleArn='arn:aws:iam::012345678901:role/example-role', | |
| RoleSessionName='ExampleSessionName') | |
| client = session.client('sqs') | |
| """ |
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
| def triangles(level): | |
| """ | |
| Pirnt triagle for the levelth | |
| """ | |
| gles = [[0 for col in range(0, level)] for row in range(0, level)] | |
| for row in range(0, level): | |
| if row == 0: | |
| gles[row][0] = 1 | |
| else: | |
| for col in range(0, level): |
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
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| import asyncio | |
| import aiohttp | |
| import async_timeout | |
| URLs = [ | |
| 'https://aiohttp.readthedocs.org/', | |
| 'https://www.baidu.com/', |