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 imp | |
| import importlib | |
| import inspect | |
| import glob | |
| import requests | |
| import os | |
| def import_from_string(content, module_name, file_name=None): | |
| if not file_name: | |
| file_name = '{0}.py'.format(module_name) |
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 | |
| from shell import Shell, Command | |
| class TestCommand(Command): | |
| def __init__(self): | |
| name = 'test' | |
| Command.__init__(self, name) | |
| def execute(self, arguments): | |
| print '123!' |
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 convert_to_string(dt, date_format): | |
| date_format = date_format.replace("yyyy", "%Y") | |
| date_format = date_format.replace("yy", "%y") | |
| date_format = date_format.replace("MMMM", "%B") | |
| date_format = date_format.replace("MMM", "%b") | |
| date_format = date_format.replace("MM", "%m") | |
| date_format = date_format.replace("M", "%m") | |
| date_format = date_format.replace("dddd", "%A") |
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 requests | |
| import sys | |
| start = int(sys.argv[1]) | |
| end = int(sys.argv[2]) | |
| def get_combinations(): | |
| for n in range(start, end): | |
| yield list(str(n).zfill(5)) |
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 python | |
| import os | |
| import re | |
| import multiprocessing | |
| import sys | |
| def patch_file(file_path, patch_callback): | |
| with open(file_path, "r+") as f: | |
| content = f.read() |
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
| #include <Wire.h> | |
| #include <LiquidCrystal_I2C.h> | |
| LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); | |
| void setup() | |
| { | |
| Serial.begin(9600); | |
| lcd.begin(20, 4); | |
| lcd.backlight(); |
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 socket | |
| def download_file_oldschool(host, page, output_file, headers={}): | |
| request = 'GET {page} HTTP/1.1\r\nHost: {host}'.format(page=page, host=host) | |
| for name, value in headers.iteritems(): | |
| request += '\r\n{name}: {value}'.format(name=name, value=value) | |
| request += '\r\n\r\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
| #!/usr/bin/env python | |
| from wsgiref.simple_server import make_server | |
| port = 8080 | |
| def request_handler(environ, start_response): | |
| status = '200 OK' | |
| headers = [('Content-Type', 'application/json')] | |
| start_response(status, headers) |
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 python | |
| import json | |
| FILES_DIRECTORY = '/home/user/Desktop/selfie/pictures' | |
| import os | |
| import posixpath | |
| import BaseHTTPServer | |
| import urllib | |
| import cgi |