Skip to content

Instantly share code, notes, and snippets.

View janbiasi's full-sized avatar
🌐
Just building

Jan R. Biasi janbiasi

🌐
Just building
View GitHub Profile
@janbiasi
janbiasi / database-helper.php
Created November 11, 2014 11:54
A simple PHP helper for working JSON including a short demo
<?php
// Get content from the DB
function readDatabase($path) {
return (array)json_decode(file_get_contents($path));
}
// Save content to the DB
function saveDatabase($path, $content) {
file_put_contents($path, json_encode($content));
@janbiasi
janbiasi / apache.sh
Last active August 29, 2015 14:09
A tiny installer for linux including Apache, MySQL, PHP and GitLab (v5.0)
#!/bin/sh
echo "You have to be the root user to execute this script!"
echo "What is your OS?"
echo "1 OpenSuSE"
echo "2 Ubuntu"
echo "3 RedHat"
echo "4 Debian"
echo "5 Go Back"
echo "6 Quit"
@janbiasi
janbiasi / installer.sh
Last active August 29, 2015 14:09
A tool for Raspian Micro Computers to optimize the Software on it
#!/bin/sh
ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
echo "\nInstalling Apache WebServer accessible with $ip ..."
sudo apt-get install apache2 -y
echo "\nInstalling PHP 5.X on $HOSTNAME ..."
sudo apt-get install php5 libapache2-mod-php5 -y
@janbiasi
janbiasi / snippet1.html
Last active August 29, 2015 14:09
Triebwerk snippets for a simple HTML and CSS website
<title>Stellwerk. Informatik. HTML. Beispiel. Namics</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script src="js/jquery.min.js"></script>
<script src="js/jquery.scrolly.min.js"></script>
<script src="js/jquery.poptrox.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/init.js"></script>
cookie.set('name', 'mmustermann', 2);
cookie.get('name');
<link rel="import" href="/racks/elements/racks.html">
<racks-element name="my-tag">
<style>
:host {
display: block;
}
</style>
<template>
<content></content>
</template>
@janbiasi
janbiasi / heroku.sh
Created March 24, 2015 08:26
Single-script heroku application creation for the shell
#!/bin/env bash
# Download latest toolbelt from their website
# https://devcenter.heroku.com/toolbelt-downloads/
heroku login
# E-Mail: ....
# Password: ....
echo -n "Enter your GitHub Repo URL: "
#!/bin/bash
yum install -y openssh-clients man git vim wget curl ntp
chkconfig ntpd on && chkconfig sshd on
chkconfig iptables off && chkconfig ip6tables off
sed -i -e 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config
sed -i 's/^\(Defaults.*requiretty\)/#\1/' /etc/sudoers
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
mkdir /home/vagrant/.ssh && chmod 700 /home/vagrant/.ssh
curl https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub >> /home/vagrant/.ssh/authorized_keys
chmod 600 /home/vagrant/.ssh/authorized_keys
@janbiasi
janbiasi / events.java
Last active August 29, 2015 14:22
Simple eventhandling for frames and so on in java
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
class MyFrame extends JFrame {
private JFrame reference = this;
JButton myButton = new JButton();
myButton.setText("Exit Applcation ...");
/* Add listener for the button to close */
myButton.addActionListener(new ActionListener() {
#!/bin/bash
sudo rm -rf /usr/local/lib/node_modules
mkdir "${HOME}/.npm-packages"
export PATH="$HOME/.node/bin:$PATH"