Skip to content

Instantly share code, notes, and snippets.

View chaosmail's full-sized avatar

Christoph Koerner chaosmail

View GitHub Profile
@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
<!DOCTYPE html>
<html>
<head>
<title>
My first demo
</title>
<!-- Link the Bootstrap css -->
<link href="components/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
@chaosmail
chaosmail / gist:9016290
Created February 15, 2014 08:41
Copy SSH Key to Ubuntu 12.04 LTS
ssh user@server.com
ssh-keygen -t rsa
exit
cat ~/.ssh/id_rsa.pub | ssh user@server.com 'cat >> ~/.ssh/authorized_keys'
@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 / 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 / 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.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.isSerialized
Created March 28, 2013 16:34
Check if String is serialized
function isSerialized($string) {
return (@unserialize($string) !== false);
}