Skip to content

Instantly share code, notes, and snippets.

View otassel's full-sized avatar

Olivier TASSEL otassel

View GitHub Profile
#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
import csv
import urllib.parse
from time import sleep
# Constant
SEMRUSH_APIKEY = ''
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import with_statement # we'll use this later, has to be here
from argparse import ArgumentParser
import requests
from BeautifulSoup import BeautifulStoneSoup as Soup
def parse_sitemap(url):
@otassel
otassel / process.txt
Created November 7, 2017 08:57
How to install Ta-lib python library on Anaconda
Download TA_Lib-0.4.10-cp27-cp27m-win_amd64.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib.
And use command
pip install TA_Lib-0.4.10-cp27-cp27m-win_amd64.whl
@otassel
otassel / example.sh
Last active December 29, 2015 09:27
Example of using an XPath expression using xmlstarlet
# Thanks : http://stackoverflow.com/questions/15461737/how-to-execute-xpath-one-liners-from-shell
xmlstarlet sel -t -v "//element/@attribute" file.xml
@otassel
otassel / functions.sh
Created December 29, 2015 09:11
Some useful shell functions for my needs
# Functions
#-----------------------------------------------------------------------------
info() {
echo -e "\r\e[0;32m [INFO]\e[0m $*"
logger -p local7.info -t "$APPLICATION[$$]" "$*"
}
exi() {
echo -e "\r\e[0;31m [ERROR]\e[0m $*"
logger -p local7.err -t "$APPLICATION[$$]" "$*"
@otassel
otassel / clean-ubuntu.sh
Created December 29, 2015 09:11
A simple shell script for cleaning a Ubuntu server
#!/bin/bash
echo -e "Ubuntu cleaner v0.1"
# We verify if we are root user
if [ ! `whoami` = "root" ]
then
echo -e "You are not root, you can't launch this script !"
exit 1
fi
@otassel
otassel / example.php
Created May 28, 2014 10:01
ZF2 How to set search form in layout
# Source : http://stackoverflow.com/questions/13804501/zf2-how-to-set-search-form-in-layout
Some ways to do that in your controller:
Using view model
$viewmodel = new ViewModel();
$viewmodel->setVariable('myvar', $myvar);
return $viewmodel;
Using layout()
@otassel
otassel / Module.php
Created May 28, 2014 09:59
ZF2 - Set a search form (or another form type) in the layout
class Module
{
public function onBootstrap($e)
{
$app = $e->getParam('application');
$app->getEventManager()->attach(MvcEvent::EVENT_RENDER, array($this, 'setFormToView'), 100);
}
public function setFormToView($event)
{
@otassel
otassel / .gitignore
Last active December 28, 2015 15:59
Zend Framework 2 Project .gitignore
# Zend #
#####################
nbproject
._*
.~lock.*
.buildpath
.idea
.project
.settings
INSTALL.txt
@otassel
otassel / example.sh
Created September 18, 2013 08:51
Convert JPG to PDF whith ImageMagick
convert -page A4 -compress jpeg image.jpg out.pdf