Skip to content

Instantly share code, notes, and snippets.

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

Vincent Loy VincentLoy

🏠
Working from home
View GitHub Profile
1. install openjdk
`sudo apt-get install openjdk-7-jdk`
2. install `android sdk`
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>simplyCountdown.js example</title>
<link rel="stylesheet" href="css/simplyCountdown.theme.default.css"/>
</head>
<body>
<section class="examples">
<div class="simply-countdown-example"></div>
@VincentLoy
VincentLoy / variables.less
Created July 5, 2016 08:50
Bootstrap Media queries LESS
@screen-phone: 480px;
@screen-tablet: 760px;
@screen-desktop: 992px;
@screen-lg-desktop: 1200px;
@screen-xs-max: (@screen-phone - 1);
@screen-sm-max: (@screen-tablet - 1);
@screen-md-max: (@screen-desktop - 1);
# Install from NPM
npm install share-selected-text
#Install from Bower
bower install share-selected-text
@VincentLoy
VincentLoy / block_tags.py
Last active November 30, 2016 09:24
Wagtail, tu aurais pu t'appeler Swagtail.
# templatetags/block_tags.py
import re
register = template.Library()
@register.inclusion_tag('tags/embed_tweet.html', takes_context=True)
def tweet_embed(context, url):
return {
'url': '{}'.format(url),
'request': context['request'],
@VincentLoy
VincentLoy / blocks.py
Created March 18, 2016 17:52 — forked from frankwiles/blocks.py
Code and Markdown blocks for Wagtail 1.0 StreamField
from django.utils.safestring import mark_safe
from markdown import markdown
from pygments import highlight
from pygments.formatters import get_formatter_by_name
from pygments.lexers import get_lexer_by_name
from wagtail.wagtailcore import blocks
class CodeBlock(blocks.StructBlock):
@VincentLoy
VincentLoy / psql.md
Last active April 19, 2016 09:07
postgres command memo - migrate here : https://github.com/VincentLoy/alzheimer

Connect as root

$ sudo -u postgres psql

Create new user

postgres=# CREATE USER example WITH PASSWORD 'example';
@VincentLoy
VincentLoy / progress.py
Created September 10, 2015 18:45
Nice Python progress bar
import sys
def progress(count, total, suffix=''):
bar_len = 50
filled_len = int(round(bar_len * count / float(total)))
percents = round(100.0 * count / float(total), 1)
bar = '█' * filled_len + '▓' * (bar_len - filled_len)
sys.stdout.write('==> {} {}{} ... {}'.format(bar, percents, '%', suffix), ending='\r')
sys.stdout.flush()
# vim: fileencoding=utf-8 tw=100 expandtab ts=4 sw=4 :
#
# GoodMorningPlanet.com
# author : Vincent Loy <vincent.loy@activkonnect.com>
# (c) 2015 ActivKonnect
"""
Repair bad formatted Markdown Files - replace **foo** by #foo
only when a line start and end by strong tag
"""
@VincentLoy
VincentLoy / monty_hall.py
Created June 25, 2015 19:16
Test with the Monty Hall problem
# vim: fileencoding=utf-8 tw=100 expandtab ts=4 sw=4 :
#
# monty-hall-problem
# copyright (c) 2015 Vincent Loy
# Vincent Loy <vincent.loy1@gmail.com>
import random
class MontyHall:
def __init__(self):