This file contains 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 bash | |
IFS=$'\n' | |
for line in $(cat .env); do | |
if [[ $line != \#* ]] ; then | |
eval 'export $line' | |
fi | |
done |
This file contains 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 create_request_factory(timeout, headers, api_session_running_url): | |
methods = ("post", "get", "delete", "long_post", "long_get", "long_delete") | |
class _Request(object): | |
def __init__(self, com): | |
self._com = com | |
class RequestFactory(object): | |
def __init__(self): | |
self._com = None |
This file contains 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 sys | |
import enaml | |
from enaml.qt.qt_application import QtApplication | |
from fbs_runtime.application_context import ApplicationContext, cached_property | |
from hstatus import ModemInfoUpdater | |
class CustomQtApplication(QtApplication): |
This file contains 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 io | |
import gzip | |
import pyperclip | |
import json | |
def get_sorted_json(url): | |
buff = io.BytesIO() | |
r = requests.get(url, stream=True) |
This file contains 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
""" | |
Allows to looking through method hierarchy source codes for selected class method | |
Usage: | |
sources = get_method_hierarchy_sources(CompanyProfileSettingsForm, 'save') | |
# shows all instances code | |
show_method_hierarchy(sources) | |
# shows shorter and prettier version |
This file contains 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
dependencies: | |
pre: | |
- sudo apt-get install libxss1 libappindicator1 libindicator7 | |
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | |
- sudo dpkg -i ./google-chrome*.deb | |
- sudo apt-get install -f |
This file contains 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 cProfile, pstats, StringIO | |
class ProfileMiddleware(object): | |
def process_request(self, request): | |
pr = cProfile.Profile() | |
pr.enable() | |
request._pr = pr | |
def process_response(self, request, response): | |
request._pr.disable() |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>WebSocket Client</title> | |
<style> | |
#output { | |
border: solid 1px #000; | |
} | |
</style> | |
</head> |
This file contains 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/bash | |
# Following the guide found at this page | |
# http://programmingarehard.com/2014/03/17/behat-and-selenium-in-vagrant.html | |
echo "\r\nUpdating system ...\r\n" | |
sudo apt-get update | |
# Create folder to place selenium in |
This file contains 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 AdapterFabric(type): | |
""" | |
Return adapter object regarding to social network | |
""" | |
instances = 0 | |
def __new__(cls, social, bases=(), dct={}): | |
cls.instances += 1 | |
adapters = [YouTubeSocialAdapter, VKSocialAdapter] |