Skip to content

Instantly share code, notes, and snippets.

View LeMeteore's full-sized avatar

Nsukami _ LeMeteore

  • Nil
  • Somewhere in the universe
View GitHub Profile
@LeMeteore
LeMeteore / README.rst
Last active August 29, 2015 14:11 — forked from dupuy/README.rst

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

def pilepoile(n, taille):
if taille == 1:
return [[n]]
else:
toutes_les_listes = []
for i in range(n + 1):
intermediates = pilepoile(n-i, taille -1)
for l in intermediates:
l.insert(0,i)
toutes_les_listes.extend(intermediates)
class MyClass:
@staticmethod
def the_static_method():
print("yeah")
@classmethod
def the_class_method(cls, x):
print("class: %s, arg x: %s" % (cls,x))
class Person:
@LeMeteore
LeMeteore / signin.py
Last active August 29, 2015 14:25 — forked from chriskief/signin.py
from django import forms
from app.models import User
from django.contrib.auth.hashers import check_password
from django.db.models import Q
class SignInForm(forms.Form):
username = forms.CharField(max_length=User._meta.get_field('email').max_length)
password = forms.CharField(min_length=6, max_length=16, widget=forms.PasswordInput())
@LeMeteore
LeMeteore / pex.md
Last active August 29, 2015 14:27 — forked from simeonf/pex.md
Creating a PEX from a python script

So you want to create a pex that packages your script and its dependencies?

Ok - first to make our script! Call it foo.py:

import requests

if __name__ == '__main__':
  req = requests.get("https://raw.githubusercontent.com/pantsbuild/pex/master/README.rst")
  print req.text.split("\n")[0]
@LeMeteore
LeMeteore / logging.py
Created December 2, 2015 22:15 — forked from adamghill/logging.py
Django logging configuration
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'root': {
'level': 'DEBUG',
'handlers': ['console', ],
},
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
@LeMeteore
LeMeteore / nginxinstaller.sh
Created December 3, 2015 21:55 — forked from ChrisMcKee/nginxinstaller.sh
install nginx from source with spdy and ssl support on CENTOS 6.5
#!/bin/bash
### VARIABLES ###
PRE_PACK="gcc gcc-c++ make pcre-devel zlib-devel unzip wget"
OPT_PACK="openssl-devel"
VER="1.5.12"
PREV_VER="1.5.11"
USER="nginx"
GROUP="nginx"
INSTALL_DIR="/etc/nginx"

Nginx Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400,000 to 500,000 requests per second (clustered), most what i saw is 50,000 to 80,000 (non-clustered) requests per second and 30% CPU load, course, this was 2xIntel Xeon with HT enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

First, you will need to install nginx, my way to install nginx is compiling it from source, but for now we will use apt-get

@LeMeteore
LeMeteore / springer-free-maths-books.md
Created December 29, 2015 18:37 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of books available for free, here are the direct links
@LeMeteore
LeMeteore / http_get.go
Created January 20, 2016 01:44 — forked from ijt/http_get.go
Example of using http.Get in go (golang)
package main
import (
"fmt"
"http"
"io/ioutil"
"os"
)
func main() {