Skip to content

Instantly share code, notes, and snippets.

View balamuruganky's full-sized avatar

Balamurugan Kandan balamuruganky

View GitHub Profile
@jameskyle
jameskyle / manual bonding configuration.sh
Created June 26, 2012 20:04
manual bonding configuration
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
@anopheles
anopheles / router.py
Created September 12, 2012 13:34
Router Dealer example with bidirectional communication
# encoding: utf-8
import zmq
from collections import defaultdict
context = zmq.Context()
client = context.socket(zmq.ROUTER)
client.bind("tcp://*:5556")
poll = zmq.Poller()
@oneamtu
oneamtu / gtest.cmake
Created September 16, 2012 20:38
How to add google test as an downloadable external project
########################### GTEST
# Enable ExternalProject CMake module
INCLUDE(ExternalProject)
# Set default ExternalProject root directory
SET_DIRECTORY_PROPERTIES(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/third_party)
# Add gtest
# http://stackoverflow.com/questions/9689183/cmake-googletest
ExternalProject_Add(
@jasongrout
jasongrout / run_once.py
Created September 29, 2012 17:46
run once decorator
# from http://stackoverflow.com/questions/4103773/efficient-way-of-having-a-function-only-execute-once-in-a-loop
from functools import wraps
def run_once(f):
"""Runs a function (successfully) only once.
The running can be reset by setting the `has_run` attribute to False
"""
@wraps(f)
def wrapper(*args, **kwargs):
if not wrapper.has_run:
@exaos
exaos / ReadMCA.py
Created January 11, 2013 03:36
ReadMCA: Convert spectra gathered by MCA8000 into ROOT format (http://root.cern.ch/)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Read data acquired by MCA8000A through software "pcma".
File extension: .mca'''
import re
def readmca(fm):
sraw=[l.strip() for l in open(fm,'r').readlines()]
kidx=[]
@bistaumanga
bistaumanga / gmm.py
Last active September 26, 2024 10:00
Gaussian Mixture Model using Expectation Maximization algorithm in python
# -*- coding: utf-8 -*-
"""
Created on Sat May 3 10:21:21 2014
@author: umb
"""
import numpy as np
class GMM:
@wonkoderverstaendige
wonkoderverstaendige / ZMQ_DEBUG.props
Created November 18, 2013 02:22
ZeroMQ C++ example server with corresponding Python client. From http://zguide.zeromq.org/page:all
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_PropertySheetDisplayName>ZMQ_DEBUG</_PropertySheetDisplayName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>%ZMQ_DIR%\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ganine
ganine / Vagrantfile
Last active March 27, 2024 08:19
Basic Vagrantfile with provisioning shell script
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.provision :shell, :privileged => false, :path => "bootstrap_ubuntu1204.sh"
end
@dbehnke
dbehnke / client.py
Created March 18, 2014 19:08
Python AsyncIO Client and Server Example using StreamReader and StreamWriter
"""
client.py - AsyncIO Server using StreamReader and StreamWriter
This will create 200 client connections to a server running server.py
It will handshake and run similar to this:
Server: HELLO
Client: WORLD
@evands
evands / combine_static_libraries.sh
Created January 14, 2015 20:40
Combine multiple .a static libraries, which may each have multiple architectures, into a single static library
#!/bin/sh
# Combined all static libaries in the current directory into a single static library
# It is hardcoded to use the i386, armv7, and armv7s architectures; this can easily be changed via the 'archs' variable at the top
# The script takes a single argument, which is the name of the final, combined library to be created.
#
# For example:
# => combine_static_libraries.sh combined-library
#
# Script by Evan Schoenberg, Regular Rate and Rhythm Software