Skip to content

Instantly share code, notes, and snippets.

@kostyll
kostyll / da_tracker_patch.txt
Created May 7, 2015 10:55
patch for da_tracker-1.9 (djangoanalytics.com) client app to make support of using this package in python 3 (python3.4 was tested)
diff --git a/da_tracker/middleware.py b/da_tracker/middleware.py
index c72451f..7ab3e3e 100644
--- a/da_tracker/middleware.py
+++ b/da_tracker/middleware.py
@@ -9,8 +9,19 @@ from django.utils.importlib import import_module
import time
import base64
import re
-import urllib2
-import Queue
@kostyll
kostyll / mininet.commands.txt
Created May 12, 2015 12:37
mininet_cli_service_management.txt
1780 sudo service openvswitch-controller stop
1781 sudo service openvswitch-controller start
1786 sudo service openvswitch-switch stop
1788 sudo service openvswitch-switch start
1789 sudo nm
1793 sudo mn --controller=ovsc
1803 sudo fuser -k 6633/tcp
1804 sudo kill -KILL 24937
1806 netstat -nl | grep 6633
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <netdb.h>
#include <string.h>
#include <netinet/in.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
//we are planning to use filter concatenation on three input videos
var filterchain = Filterchain.FilterTo<VideoStream>(new Concat());
//we want our output to be encoded using the following settings:
// -c:v libx264
// -b:v 3000k
// -s 852x480
// -y
var settings = SettingsCollection.ForOutput(
new CodecVideo("libx264"),
#include <cstdio>
#include <string>
class MyIOContext {
public:
std::string datafile;
AVIOContext *ioCtx;
uint8_t *buffer; // internal buffer for ffmpeg
int bufferSize;
FILE *fh;
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@kostyll
kostyll / daemon.py
Created July 2, 2015 19:36
python_daemon.py
#!/usr/bin/env python
# source: https://github.com/MartSlaaf/PyDaemon
import sys
import os
import time
import atexit
import signal
@kostyll
kostyll / daemon.py
Created July 2, 2015 20:57
python_daemon.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# source: https://github.com/MartSlaaf/PyDaemon
import sys
import os
import time
import atexit
from signal import SIGTERM
im1 = 'eNMItpUG.png'
im1
im1_path = 'eNMItpUG.png'
from PIL import Image
im1 = Image.open(im1_path)
im1
im1.fromstring()
im1.getim
im1.getim()
im1.tostring()
@kostyll
kostyll / something.i
Last active September 24, 2015 12:25 — forked from oliora/something.i
SWIG interface with using of Python callable as callback
%module(threads="1") something
%{
// Register a callback (called from Python code)
// callbackFunc is a Python callable accepting one argument
void registerHandler(PyObject *callbackFunc)
{
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
const bool hasCallback =