Skip to content

Instantly share code, notes, and snippets.

View snehesht's full-sized avatar

Snehesh snehesht

View GitHub Profile
@snehesht
snehesht / coro.py
Last active August 29, 2015 14:16 — forked from keis/coro.py
# 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
// 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!!!
@snehesht
snehesht / Nginx SSL Config.txt
Last active August 29, 2015 14:18
Nginx SSL Config
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
#!/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)
@snehesht
snehesht / Python logging for every day.txt
Last active August 29, 2015 14:20
Python logging for every day
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
@snehesht
snehesht / arXiv popularity scoring.ipynb
Last active September 7, 2015 04:59 — forked from nebw/arXiv popularity scoring.ipynb
Popularity scoring for arXiv publications
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@snehesht
snehesht / docker-init.bat
Last active September 17, 2015 05:48
Automates the process of switching the docker-machine environments
:: Author: Snehesh Thalapaneni
:: Description: Automates the process of switching the docker-machine environments. Just type in the machine name the script will setup the environment for you.
:: Compatable with Windows x86, x64 systems
@echo off
if [%1]==[] goto help
echo @echo off >> temp_config.bat
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
#!/usr/bin/env python
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" getTerminalSize()
@snehesht
snehesht / nginx-non-transparent-ssl-proxy.md
Created October 27, 2015 15:15 — forked from dannvix/nginx-non-transparent-ssl-proxy.md
Guide to set up nginx as non-transparent SSL proxy, which subsitutes strings in the server responses

Use nginx as Non-Transparent SSL Proxy

Introduction

Many mobile apps have back-end API servers. They usually rely on the API replies to determine whether certain information is supposed to be shown. If the API responses could be manipulated on the fly, we may easily fool an unmodified app to expose some private data.

This manual guides you to set up nginx as non-transparent SSL proxy, which just subsitutes strings in the server responses (i.e. man-in-the-middle attack ourself). For both server-side (their API servers) and client-side (your device), the whole process is almost transparent.