Skip to content

Instantly share code, notes, and snippets.

View tashirka1's full-sized avatar
🏠
Working from home

t tashirka1

🏠
Working from home
View GitHub Profile
@tashirka1
tashirka1 / gh-pages-deploy.md
Created May 29, 2018 08:53 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@tashirka1
tashirka1 / nginx.conf
Created May 7, 2018 07:05 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# Advanced config for NGINX
server_tokens off;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
@tashirka1
tashirka1 / install_docker_bash_completions.sh
Created April 27, 2018 06:34 — forked from toschneck/install_docker_bash_completions.sh
Install Docker and Docker-Compose bash completion
#!/usr/bin/env bash
set -e
echo "install docker bash completion"
curl -L https://raw.githubusercontent.com/docker/docker/v$(docker version --format '{{.Server.Version}}')/contrib/completion/bash/docker -o /etc/bash_completion.d/docker
echo "install docker-compose bash completion"
curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
echo ".... done!"
@tashirka1
tashirka1 / gist:0cbf0366bbcdbfb99efde30308dd3fd2
Created April 21, 2018 20:24 — forked from moraes/gist:2141121
LIFO Stack and FIFO Queue in golang
package main
import (
"fmt"
)
type Node struct {
Value int
}
Run Docker commands without sudo
1. Add the docker group if it doesn't already exist
$ sudo groupadd docker
2. Add the connected user $USER to the docker group
Optionally change the username to match your preferred user.
$ sudo gpasswd -a $USER docker
3. Restart the docker daemon
$ sudo service docker restart
If you are on Ubuntu 14.04-15.10, use docker.io instead:
@tashirka1
tashirka1 / nginz-gzip.conf
Created April 18, 2018 07:37 — forked from fabrikagency/nginz-gzip.conf
nginx settings for good gzip compression
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# make sure gzip does not lose large gzipped js or css files
# see http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl
gzip_buffers 16 8k;
@tashirka1
tashirka1 / setup.py
Created April 16, 2018 07:32 — forked from Deusdies/setup.py
Creating an executable file with Python 3.6, cx_Freeze
"""
== SETUP.PY FILE FOR USE WITH CX_FREEZE AND PYTHON 3.6 ==
==== INSTRUCTIONS ====
1. Make sure you have Python 3.6 installed.
2. Install cx_Freeze by typing `pip install cx_freeze` in the Terminal or Command Prompt. Make sure to use the pip for Python 3 (sometimes called pip3)
3. Create a new file called setup.py and paste the contents of this file in it (or just download this file)
4. Make sure to place the setup.py file in the same directory where your main Python application is located
5. From the Terminal/Command Prompt, run `python setup.py build`. Make sure that you're running Python 3.6 (use `python --version`)

The numbers claimed by this benchamark about Gevent [1] comparaed with the numbers got by Asyncio with the uvloop and even with the default loop has left me a bit frozen. Ive repeated a few of them : gevent, asyncio, asyncio-uvloop and go for the echo server and these are the numbers roughly:

For gevent

$ ./echo_client
685393 0.98KiB messages in 30 seconds
Latency: min 0.04ms; max 4.48ms; mean 0.126ms; std: 0.048ms (37.68%)
Latency distribution: 25% under 0.088ms; 50% under 0.122ms; 75% under 0.158ms; 90% under 0.182ms; 99% under 0.242ms; 99.99% under 0.91ms
@tashirka1
tashirka1 / libevent-v-libuv.md
Created April 13, 2018 05:39 — forked from eddieh/libevent-v-libuv.md
libevent vs libuv

libevent vs libuv

Comparing libevent and libuv. My upfront biased: I want to like libevent. However, I want to objectively compare the two and make an informed decision.

What versions are we comparing?

  • libevent 2.0.22 (Stable) [2014-01-05]
  • libuv 1.8.0 (Stable) [2015-12-15]
@tashirka1
tashirka1 / libevent-v-libuv.md
Created April 13, 2018 05:39 — forked from eddieh/libevent-v-libuv.md
libevent vs libuv

libevent vs libuv

Comparing libevent and libuv. My upfront biased: I want to like libevent. However, I want to objectively compare the two and make an informed decision.

What versions are we comparing?

  • libevent 2.0.22 (Stable) [2014-01-05]
  • libuv 1.8.0 (Stable) [2015-12-15]