Skip to content

Instantly share code, notes, and snippets.

@ledil
ledil / oracle_java_7_ubuntu
Created November 22, 2012 09:06
Oracle Java 7 Ubuntu
$ sudo echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installer
$ java -version
If 1.7.0 will not be displayed:
$ sudo update-java-alternatives -s java-7-oracle
@ledil
ledil / gist:195bcbb935d8610451ab
Last active August 29, 2015 14:03
Django Profiler
import hotshot
import os
import time
from django.conf import settings
try:
PROFILE_LOG_BASE = settings.PROFILE_LOG_BASE
except:
PROFILE_LOG_BASE = "/tmp"
#!/usr/bin/env python
# coding=utf-8
#
# @file gevent_zmq_redis_demo.py
# @author kaka_ace <[email protected]>
# @date Tue Oct 14 2014
"""
fetures: there are two concurrent tasks
1. From Redis server, Getting the notify msg with BLPOP operation,
@ledil
ledil / gist:26cdbb5d41dccade3a6e
Last active August 29, 2015 14:18
nginx + nginx-push-stream-module
$ sudo add-apt-repository -y ppa:nginx/stable
$ sudo apt-get update
$ cat /etc/apt/sources.list.d/nginx-stable-trusty.list
deb http://ppa.launchpad.net/nginx/stable/ubuntu trusty main
deb-src http://ppa.launchpad.net/nginx/stable/ubuntu trusty main
$ sudo apt-get update
$ sudo apt-get install -y dpkg-dev
$ sudo mkdir /opt/rebuildnginx
@ledil
ledil / install_opencv.sh
Last active February 22, 2016 21:48
install opencv 3.x ubuntu 14.04 compile prepare packages and on rasbian jessie (raspberry pi)
#!/bin/sh
sudo apt-get update
if which raspi-config >/dev/null; then
sudo apt-get upgrade
fi
sudo apt-get -y install build-essential cmake git pkg-config python-dev
sudo apt-get -y install libjpeg-dev libtiff5-dev libjpeg8-dev libjasper-dev libpng12-dev
sudo apt-get -y install libgtk2.0-dev
sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get -y install libatlas-base-dev gfortran libxvidcore-dev libx264-dev
@ledil
ledil / install_linphone.sh
Last active February 22, 2016 09:21
install_linphone.sh
#!/bin/sh
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:george-edison55/cmake-3.x
sudo apt-get update
sudo apt-get install cmake libgtk2.0-dev libspeexdsp-dev \
libavcodec-dev libswscale-dev libx11-dev libxv-dev libgl1-mesa-dev \
libglew1.6-dev libv4l-dev libxml2-dev libtool automake intltool
sudo apt-get install libantlr3c-dev pkg-config libantlr3c-dev antlr3 g++ make
sudo apt-get install libreadline-dev libgsm1-dev libtheora-dev \
libsqlite3-dev libupnp6-dev libsrtp-dev
@ledil
ledil / sinon.js fake server example
Created June 16, 2016 13:59
sinon.js fake server example
/*
Load Sinon.JS in the SpecRunner:
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine-html.js"></script>
<script type="text/javascript" src="sinon-1.0.0.js"></script>
<script type="text/javascript" src="sinon-ie-1.0.0.js"></script>
http://cjohansen.no/sinon/
*/
describe("SinonFakeServerWithJasmine", function() {
@ledil
ledil / haproxy.cfg
Created January 30, 2017 12:51 — forked from tikenn/haproxy.cfg
Let's Encrypt Auto-Renewal script for HAProxy
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 2048
@ledil
ledil / idle.sh
Created July 5, 2017 12:29 — forked from ikbear/idle.sh
Docker image entrypoint idle script
#!/bin/bash
echo "This is a idle script (infinite loop) to keep container running."
echo "Please replace this script."
cleanup ()
{
kill -s SIGTERM $!
exit 0
}
@ledil
ledil / extj
Created July 12, 2017 07:46
extjs grid store abort
Ext.define('Ext.enhance.data.Store', {
override: 'Ext.data.Store',
constructor: function(config) {
var me = this;
me.callParent([config]);
me.on({
'beforeload': function(store, operation) {
// keep the operation which has request object
store.lastOperation = operation;
}