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
# Coroutines Demo using asyncio | |
import asyncio | |
@asyncio.coroutine | |
def waiting(r): | |
print("hello from waiting -", r) | |
yield from asyncio.sleep(2) | |
print("bye from waiting -", r) | |
return r |
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://geekgirl.io/concurrent-http-requests-with-python3-and-asyncio/ | |
Concurrent HTTP Requests with Python3 and asyncio | |
My friend who is a data scientist had wipped up a script that made lots (over 27K) of queries to the Google Places API. The problem was that it was synchronous and thus took over 2.5hours to complete. | |
Given that I'm currently attending Hacker School and get to spend all day working on any coding problems that interests me, I decided to go about trying to optimise it. | |
I'm new to Python so had to do a bit of groundwork first to determine which course of action was best. |
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
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | |
/* AES Counter-mode implementation in JavaScript (c) Chris Veness 2005-2014 / MIT Licence */ | |
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | |
/* jshint node:true *//* global define, escape, unescape, btoa, atob */ | |
'use strict'; | |
if (typeof module!='undefined' && module.exports) var Aes = require('./aes'); // CommonJS (Node.js) | |
/** |
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
// Go to menue: | |
// find->find in files | |
// Switch on reg_ex button | |
// Find: | |
^(.*)$ | |
// Where: | |
c:\your_folder\,*.php,*.phtml,*.js,*.inc,*.html, -*/folder_to_exclude/* | |
// Then click on the find button | |
// Be careful to not click on Replace!!! |
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
Optimizing HTTPS on Nginx https://bjornjohansen.no/optimizing-https-nginx | |
Now that you have secured Nginx with HTTPS and enabled SPDY, it’s time to improve both the security and the performance of the server. | |
Nginx out-of-the-box is already performing quite well, and as far as I know, is the only web server with forward secrecy (FS) enabled by default (more on FS support in servers and clients here). There is still a few things we can configure to make Nginx faster and more secure. | |
NOTE: All of the configuration directives explained here will be for your server block in your Nginx config. | |
Step 1: Connection credentials caching |
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
Src : http://stackoverflow.com/questions/17590816/kernel-based-linux-data-relay-between-two-tcp-sockets | |
# With Nginx | |
TCP Connections load-balancing | |
# With HAProxy | |
Using Linux TCP Splicing with HAProxy | |
Willy Tarreau <[email protected]> | |
- 2007/01/06 - |
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 | |
import sys #for cmd line argv | |
#take command line args as the input string | |
input_string = sys.argv | |
#remove the program name from the argv list | |
input_string.pop(0) | |
#convert to google friendly url (with + replacing spaces) |
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://www.lexev.org/en/2013/python-logging-every-day/ | |
Python logging for every day | |
Gist | |
When writing a small python program or script, it is sometimes needed to output debug message or maybe event. It is known, that python has logging module exactly for that purpose. But in my case usually such thing happens: it is lack of time and hands just writes print instead of logging, because i can't remember all those complicated logging settings. But then, if script is launched often or i must provide it to customer, i have to replace all prints with logging, because it is better to log all messages to file. So, not to keep in my head all these settings, i am writing this post. | |
Logging requirements will be the following: | |
All logs must be written to file and in console (duplicated) | |
Log file is rotated (not exceed specified size) | |
All third party libraries logs are also handled |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
https://github.com/SoftEtherVPN/SoftEtherVPN/ | |
http://www.softether.org/ | |
http://www.softether-download.com/files/softether/v4.18-9570-rtm-2015.07.26-tree/Linux/SoftEther_VPN_Server/32bit_-_ARM_EABI/ | |
sudo apt-get install libreadline-dev libssl-dev | |
git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git | |
cd SoftEtherVPN | |
./configure |
OlderNewer