Skip to content

Instantly share code, notes, and snippets.

@Benoss
Benoss / output.html
Last active July 11, 2018 01:54
Python Standalone plotly template
<html>
<head>
<title>test</title>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div style="display: flex; flex-flow: row wrap;">
<div style="width: 50%; height:400px;"><div id="dd4338a2-db39-4984-9ad0-911ebb98ff11" style="height: 100%; width: 100%;" class="plotly-graph-div"></div><script type="text/javascript">window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("dd4338a2-db39-4984-9ad0-911ebb98ff11", [{"y": [5, 16, 18, 5, 7, 2, 17, 18, 1, 6, 2, 4], "x": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "type": "scatter"}], {}, {"linkText": "", "showLink": true})</script></div>
@Benoss
Benoss / update_git_and_release.sh
Last active May 11, 2016 00:04
Example of cron base auto release script using a git remote origin with lock file in case of long release process
#!/bin/bash
# Example of cron base auto release script using a git remote origin with lock file in case of long release process
# * * * * * /path/to/the/file/update_git_and_release.sh
# die on non-zero status
set -e;
# die on undefined variable
set -u;
@Benoss
Benoss / foo.service
Last active April 19, 2016 23:51
Simple Systemd blocking service auto start
#/etc/systemd/system/foo.service
[Unit]
#Description of the service
Description=foo
#Auto start on reboot when the target user target is availaible
After=multi-user.target
[Service]
#Switching the working directory (not needed, just an example)
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
rm get-pip.py
sudo pip install virtualenv
#virtualenv --no-site-packages my_virtualenv_name
mkdir .virtualenvs
sudo pip install virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/git
# -*- coding: utf-8 -*-
import pip, os
from pip.commands.list import ListCommand
from pip.req import parse_requirements
import re
import argparse
class MyListCommand(ListCommand):
<?php
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$IParray=array_values(array_filter(explode(',',$_SERVER['HTTP_X_FORWARDED_FOR'])));
$_SERVER['REMOTE_ADDR'] = reset($IParray);
}
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
$_SERVER['REQUEST_SCHEME'] = 'https';
$_SERVER['HTTPS']='on';
#/usr/bin/sh
sudo apt-get update
sudo apt-get --yes install python-pip
sudo apt-get --yes install vim
sudo apt-get --yes install htop
sudo apt-get --yes install ncdu
sudo pip install --upgrade 'pip<7'
sudo pip install --upgrade ansible
sudo pip install --upgrade virtualenv virtualenvwrapper
sudo apt-get dist-upgrade -V
@Benoss
Benoss / 0_reuse_code.js
Last active August 29, 2015 14:14
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
@Benoss
Benoss / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
@Benoss
Benoss / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../core-ajax/core-ajax.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: relative;