Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Kasun Thennakoon tmkasun

🏠
Working from home
View GitHub Profile
@squarewf
squarewf / rrdbackup
Last active Jan 9, 2021
OpenWrt /etc/init.d/ script to backup and restore the rrd (collectd) database, to preserve data across reboots
View rrdbackup
#!/bin/sh /etc/rc.common
# OpenWrt /etc/init.d/ script to backup and restore the rrd (collectd) database, to preserve data across reboots
#
#
# howto:
# - upload this file as /etc/init.d/rrdbackup
# - (optional) adjust BACKUP_DIR below to point to a different target directory for the backup (e.g., a USB drive)
# - # chmod +x /etc/init.d/rrdbackup
# - # /etc/init.d/rrdbackup enable
@tmkasun
tmkasun / dev_mode.sh
Last active Oct 17, 2019
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 ...
View dev_mode.sh
#! /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
@volkancakil
volkancakil / instGlobal.sh
Last active Feb 4, 2021
How to install GNU Global 6.5.6 on Ubuntu 16.10
View instGlobal.sh
#!/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
@benkulbertis
benkulbertis / cloudflare-update-record.sh
Last active Feb 20, 2021
Cloudflare API v4 Dynamic DNS Update in Bash
View cloudflare-update-record.sh
#!/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)
@rozifus
rozifus / Python SimpleHTTPServer with SSL
Last active Feb 18, 2021
Python SimpleHTTPServer with SSL
View 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/
@debasishg
debasishg / gist:b4df1648d3f1776abdff
Last active Jan 20, 2021
another attempt to organize my ML readings ..
View gist:b4df1648d3f1776abdff
  1. Feature Learning
  1. Deep Learning
@imesh
imesh / cp-cep-artifacts.sh
Created Dec 26, 2013
Copy CEP artifacts from source to server deployment folders
View cp-cep-artifacts.sh
#!/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
#
@mrrooijen
mrrooijen / run.rb
Created May 28, 2013
Quick `open3` wrapper for running a synchronous system command and returning the pid, exit_status, stdout and stderr of the provided command.
View run.rb
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
}
@creativeaura
creativeaura / server.py
Created May 9, 2013
Modifying Python's SimpleHTTPServer to accept directory aliases
View server.py
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'],
@amueller
amueller / mlp.py
Created Mar 17, 2012
Multi-Layer Perceptron for scikit-learn with SGD in Python
View mlp.py
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