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
| a = [1, 2, 3] | |
| b = [4, 5, 6] | |
| c = [7, 8, 9] | |
| def chain(x, y): | |
| yield from x | |
| yield from y | |
| for x in chain(a, b): | |
| print(x, 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
| --[[ | |
| Lua wrapper for OpenCC. | |
| --]] | |
| local ffi = require("ffi") | |
| local opencc = ffi.load("/usr/lib64/libopencc.so.2") | |
| -- Define C API bindings | |
| ffi.cdef[[ |
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 asyncio | |
| from contextlib import closing | |
| import aiohttp | |
| from aiohttp import ClientSession | |
| async def do_sth(session, n=0): | |
| if n < 0: | |
| n = 0 | |
| n %= 3 | |
| url = "http://localhost:8000/{}".format(n) |
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 Observable: | |
| def __init__(self): | |
| self.__observers = [] | |
| def register_observer(self, observer): | |
| self.__observers.append(observer) | |
| def notify_observers(self, *args, **kwargs): | |
| for observer in self.__observers: | |
| observer.notify(self, *args, **kwargs) |
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 asyncio | |
| class EchoProtocol(asyncio.Protocol): | |
| def connection_made(self, transport): | |
| self.transport = transport | |
| def connection_lost(self, exc): | |
| self.transport = None |
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
| #!/bin/sh | |
| # Homebrew Script for OSX | |
| # To execute: save and `chmod +x ./brew-install-script.sh` then `./brew-install-script.sh` | |
| echo "Installing brew..." | |
| /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| echo "Installing brew cask..." | |
| brew install caskroom/cask/brew-cask |
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
| # Folder view configuration files | |
| .DS_Store | |
| Desktop.ini | |
| # Thumbnail cache files | |
| ._* | |
| Thumbs.db | |
| # Files that might appear on external disks | |
| .Spotlight-V100 |
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
| # http://editorconfig.org | |
| root = true | |
| [*] | |
| indent_style = space | |
| indent_size = 4 | |
| insert_final_newline = true | |
| trim_trailing_whitespace = true | |
| end_of_line = lf |
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 paramiko | |
| import os | |
| HOST = 'youdomain.com' | |
| PORT = 22 | |
| USERNAME = 'username' | |
| PASSWORD = 'password' | |
| REMOTE_PATH = '/remote/sftp/path/' | |
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/python | |
| # -*- coding: utf-8 -*- | |
| import sys | |
| import time | |
| from progressbar import AnimatedMarker, Bar, BouncingBar, Counter, ETA, \ | |
| FileTransferSpeed, FormatLabel, Percentage, \ | |
| ProgressBar, ReverseBar, RotatingMarker, \ | |
| SimpleProgress, Timer |