Skip to content

Instantly share code, notes, and snippets.

View chaosmail's full-sized avatar

Christoph Koerner chaosmail

View GitHub Profile
@chaosmail
chaosmail / install_python3.sh
Last active March 24, 2024 20:02
Install Python 3.4.3 on Ubuntu
## Common Packages
# ---------------
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install software-properties-common libssl-dev openssl wget
## Install latest Python 3
# -----------------------
PY_VERSION=3.4.3
PY_URL="https://www.python.org/ftp/python/$PY_VERSION/Python-$PY_VERSION.tgz"
@chaosmail
chaosmail / python-pid_controller
Last active September 26, 2022 13:13
Simple PID Controller
def pid_controller(y, yc, h=1, Ti=1, Td=1, Kp=1, u0=0, e0=0)
"""Calculate System Input using a PID Controller
Arguments:
y .. Measured Output of the System
yc .. Desired Output of the System
h .. Sampling Time
Kp .. Controller Gain Constant
Ti .. Controller Integration Constant
Td .. Controller Derivation Constant
@chaosmail
chaosmail / AngularFullstackHeroku.md
Last active February 8, 2018 23:06
Step-by-Step deploying AngularJS-Fullstack-generator to Heroku

Prerequisites

Install Yeoman and AngularJS-Fullstack generator

[http://yeoman.io/] (Yeoman)

npm install -g yo
@chaosmail
chaosmail / deploy.prototxt
Last active December 9, 2017 16:44 — forked from tzutalin/deploy.prototxt
Network In Network
name: "nin_imagenet"
input: "data"
input_shape {
dim: 10
dim: 3
dim: 224
dim: 224
}
layers {
bottom: "data"
#!/usr/bin/env bash
set -e
currentVersion=`cat package.json | grep version | sed 's/[",:]//g' | awk '{print $2}'`
npm install
npm run compile
git checkout --orphan "build-$currentVersion"
find . -maxdepth 1 -type d -not -name "build" -not -name "docs" -not -name ".*" -exec rm -rf {} \;
@chaosmail
chaosmail / install-maven-centos.md
Last active March 28, 2017 14:50 — forked from skanjo/install-maven-centos.md
Install Apache Maven on CentOS

For the latest download link check the Apache Maven download page:

https://maven.apache.org/download.cgi

Download Apache Maven

cd~
wget "wget http://www-eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz"

Create directory and install

@chaosmail
chaosmail / nginx-localhost-configuration
Last active January 4, 2016 09:28
nginx-localhost-configuration
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name .my_site.dev;
root /var/www/my_site/public;
# It's always good to set logs, note however you cannot turn off the error log
# setting error_log off; will simply create a file called 'off'.
access_log /var/log/nginx/my_site.access.log;
@chaosmail
chaosmail / PHP.encodeHtml
Created March 28, 2013 16:37
UTF-8 Encode HTML-String
function encodeHtml($string) {
return htmlentities($string, ENT_QUOTES, "utf-8");
}
@chaosmail
chaosmail / PHP.decodeHtml
Created March 28, 2013 16:38
UTF-8 Decode HTML-String
function decodeHtml($string) {
return stripslashes(html_entity_decode( $string, ENT_QUOTES, "utf-8" ));
}
@chaosmail
chaosmail / PHP.isSerialized
Created March 28, 2013 16:34
Check if String is serialized
function isSerialized($string) {
return (@unserialize($string) !== false);
}