Skip to content

Instantly share code, notes, and snippets.

View lee-pai-long's full-sized avatar
💭
Work In Progress

Saïdina MOHAMED ALI lee-pai-long

💭
Work In Progress
  • Marseille (France)
View GitHub Profile
@lee-pai-long
lee-pai-long / install.sh
Created September 25, 2019 08:33 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@lee-pai-long
lee-pai-long / nginx.conf
Last active March 30, 2018 12:30 — forked from weapp/nginx.conf
Return common errors as json in Nginx
# TODO: Change file name to errors.conf and load it on APIs servers block.
# TODO: Change .html to .json.
error_page 500 /500.html;
location /500.html{
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}';
}
error_page 502 /502.html;
location /502.html{
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}';
@lee-pai-long
lee-pai-long / caller_info.py
Last active March 20, 2024 16:42 — forked from techtonik/caller_name.py
Python - inspect - Get full caller info: package, module, (class), function, line.
"""
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@lee-pai-long
lee-pai-long / yourapp
Created March 14, 2017 10:23 — forked from leplatrem/yourapp
gunicorn virtualenv init.d script (could be simpler with upstart)
#! /bin/bash
### BEGIN INIT INFO
# Provides: yourapp
# Required-Start: nginx
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: The main django process
# Description: The gunicorn process that receives HTTP requests
# from nginx
@lee-pai-long
lee-pai-long / gist:1ed12786328d1fc960f5ae97181ca1fc
Created May 25, 2016 09:30 — forked from telent/gist:9742059
12 factor app configuration vs leaking environment variables
App configuration in environment variables: for and against
For (some of these as per the 12 factor principles)
1) they are are easy to change between deploys without changing any code
2) unlike config files, there is little chance of them being checked
into the code repo accidentally
3) unlike custom config files, or other config mechanisms such as Java
@lee-pai-long
lee-pai-long / beautiful_idiomatic_python.md
Created April 29, 2016 16:37 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
#!/bin/bash
# Set path variables
DIR=`pwd`
SYS_PACKAGES=/usr/local/lib/python2.7/dist-packages
VENV_PACKAGES=$DIR/Venv-Linux/lib/python2.7/site-packages
# Install all kivy dependencies via Apt.
@lee-pai-long
lee-pai-long / deadsnakes.sh
Created March 15, 2016 14:03
Enable deadsnakes PPA, install Python 2.6, 2.7, 3.2 and 3.3, install easy_install and pip in to those versions
#!/usr/bin/env bash
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O /tmp/ez_setup.py
py_ver=`python -c 'import sys; print ".".join(str(x) for x in sys.version_info[:2])'`
for i in 2.6 2.7 3.2 3.3
do
if [ "$i" != "$py_ver" ]
@lee-pai-long
lee-pai-long / 0_reuse_code.js
Created March 2, 2016 10:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/bin/bash
#
# Converts LDIF data to CSV.
# Doesn't handle comments very well. Use -LLL with ldapsearch to remove them.
#
# 2010-03-07
# dsimmons@squiz.co.uk
#
# Show usage if we don't have the right params