Skip to content

Instantly share code, notes, and snippets.

View tmkasun's full-sized avatar
🕶️

Kasun Thennakoon tmkasun

🕶️
View GitHub Profile
@lukemarsden
lukemarsden / httpRequest.py
Created February 27, 2011 21:11
Simple function to do an HTTP POST using Twisted Agent
from twisted.web.iweb import IBodyProducer
from twisted.internet import defer
from twisted.web.client import Agent
from twisted.web.http_headers import Headers
import urllib
class StringProducer(object):
implements(IBodyProducer)
def __init__(self, body):
@amueller
amueller / mlp.py
Created March 17, 2012 15:59
Multi-Layer Perceptron for scikit-learn with SGD in Python
import numpy as np
import warnings
from itertools import cycle, izip
from sklearn.utils import gen_even_slices
from sklearn.utils import shuffle
from sklearn.base import BaseEstimator
from sklearn.base import ClassifierMixin
from sklearn.preprocessing import LabelBinarizer
@creativeaura
creativeaura / server.py
Created May 9, 2013 10:34
Modifying Python's SimpleHTTPServer to accept directory aliases
import os
import posixpath
import urllib
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
# modify this to add additional routes
ROUTES = (
# [url_prefix , directory_path]
['/media', '/var/www/media'],
@mrrooijen
mrrooijen / run.rb
Created May 28, 2013 17:05
Quick `open3` wrapper for running a synchronous system command and returning the pid, exit_status, stdout and stderr of the provided command.
require "open3"
def run(cmd)
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
return {
pid: wait_thr.pid,
exit_status: wait_thr.value.to_i,
stdout: stdout.read,
stderr: stderr.read
}
@imesh
imesh / cp-cep-artifacts.sh
Created December 26, 2013 14:31
Copy CEP artifacts from source to server deployment folders
#!/bin/bash
# -----------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
@debasishg
debasishg / gist:b4df1648d3f1776abdff
Last active January 20, 2021 12:15
another attempt to organize my ML readings ..
  1. Feature Learning
  1. Deep Learning
@rozifus
rozifus / Python SimpleHTTPServer with SSL
Last active October 9, 2022 22:40
Python SimpleHTTPServer with SSL
# useful for running ssl server on localhost
# which in turn is useful for working with WebSocket Secure (wss)
# copied from http://www.piware.de/2011/01/creating-an-https-server-in-python/
@benkulbertis
benkulbertis / cloudflare-update-record.sh
Last active April 28, 2024 16:35
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="user@example.com"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"
# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)
@volkancakil
volkancakil / instGlobal.sh
Last active October 12, 2022 14:59
How to install GNU Global 6.5.6 on Ubuntu 16.10
#!/bin/bash
# instGlobal.sh
echo "instGlobal.sh ...."
echo "install package for GNU global..."
sudo apt-get update
sudo apt-get -y install curl
sudo apt-get -y install wget
sudo apt-get -y install ncurses-dev
@tmkasun
tmkasun / dev_mode.sh
Last active October 17, 2019 09:02
Setup APIM server and Run it with it's depending servers, Will only be useful until API manager product properly pack the dependencies in to final product. Till we get there ...
#! /usr/bin/env bash
# HOW TO USE: Put this file inside the directory where you would like to extract and run the product-APIM build file (.zip file)
# Change the below path variables accordingly *** NOTE: No trailing `/` slashes has been used
# This will only work with APIM 3.0.0 latest version with Carbon 4.x kernel. Addition to coping and unziping the pack,
# This script will only create symbolic links to the carbon-apimgt repository files.
source_path="/Users/tmkasun/Documents/wso2/dev/products/apim/carbon-apimgt-forked/features/apimgt"
product_apimgt_path="/Users/tmkasun/Documents/wso2/dev/products/apim/product-apim-forked"
pack_name="wso2am-3.0.0-SNAPSHOT"
action=$1