Skip to content

Instantly share code, notes, and snippets.

View Gmanweb's full-sized avatar

Gearoid Maguire Gmanweb

View GitHub Profile
<?php
$connection = DatabaseConnection::getInstance();
$query = "SELECT * FROM fixturesresults";
$result = mysqli_query($connection->getConnection() , $query);
while($row = mysqli_fetch_array($result)){
// what data you need here Gman :)
}
@Gmanweb
Gmanweb / MarrageStatus
Created June 21, 2014 12:39
small program to get tax band
import java.util.Scanner;
public class Status{
public static void main(String [] args){
System.out.print("enter salary");
Scanner intIn = new Scanner(System.in);
int sal = intIn.nextInt();
// A* for libgdx that is simple but optimized.
package test;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
To open the Windows command prompt you may do one of the following:
- Click Start -> Programs -> Accessories -> Command Prompt
- Click Start (or hit the Windows key), type “cmd” in search, then hit [ENTER]
- Windows Key + R (#r, not the pound symbol) brings up Run. Then type “cmd” then [ENTER]
************* Basic Command Prompt Commands *************
x /? = provides syntax info and complete list of all parameters for x (a command, like “cd”)
cd = change directory
cd .. = move to the parent directory
cd\ = move to the root of current drive
@Gmanweb
Gmanweb / Install Java and Set Home
Created June 29, 2015 16:25
Linux install java JRE/JDK and set Java HOME
// Check to see if java is installed
java -version
// Installing default JRE/JDK
// This will install the Java Runtime Environment (JRE).
sudo apt-get install default-jre
// Java Development Kit (JDK)
sudo apt-get install default-jdk
@Gmanweb
Gmanweb / Ubuntu Dev Env Software Install
Created June 29, 2015 16:27
Software Installation
// Gearoid Maguire Date: 26/06/2015
// Ubuntu Software for Dev Env
// Install Android Studio
sudo apt-add-repository ppa:paolorotolo/android-studio
sudo apt-get update
sudo apt-get install android-studio
// Install Sublime Text 3
sudo add-apt-repository ppa:webupd8team/sublime-text-3
@Gmanweb
Gmanweb / Logstash, Elasticsearch in an EC2_AWS enviroment
Created September 29, 2015 10:19 — forked from gzholder/Logstash, Elasticsearch in an EC2_AWS enviroment
Logstash, Elasticsearch in an EC2_AWS enviroment
Here I will go over how to setup Logstash, Kibana, Redis, and Elasticsearch in an EC2 environment behind a public Load Balancer. The setup I'll be doing will have:
1) One server for Redis to act as the broker/buffer to receive logs.
2) One server using Logstash receive logs from Redis and parse/index them over to Elasticsearch.
3) One server for Elasticsearch to receive logs and Kibana to view them in a browser.
4) One server to send the logs using logstash.
5) One public Load Balancer.
This may seem like a lot but follow these steps and you'll get the hang of it :)
What you will need:
@Gmanweb
Gmanweb / kafka_install.md
Created November 5, 2015 15:44 — forked from leommoore/kafka_install.md
Kafka - Messaging Basics

#Kafka - Messaging Basics This assumes you are starting fresh and have no existing Kafka or ZooKeeper data. See http://kafka.apache.org/documentation.html#quickstart for more details.

##Install Java

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
@Gmanweb
Gmanweb / diskSpaceAlert.sh
Last active February 24, 2016 12:02
Monitor disk space on EC2 instance, send email to alert. Install mail, on CentOS/Redhat: yum install mailx on Ubuntu/Debian yum install mailx. See http://tecadmin.net/bash-mail-command-not-found/#. Create the file in home directory "/home" sudo nano diskSpaceAlert.sh, copy the code below and add your email addresses. change the file permissions …
#!/bin/bash
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
THRESHOLD=83
SERVER=$(ifconfig | perl -nle 's/dr:(\S+)/print $1/e')
EMAILS="[email protected],[email protected]"
if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
mail -s 'Disk Space Alert on ELK-STG' $EMAILS << EOF
Your root partition remaining free space is critically low. Used: $CURRENT%
Please login and clear some space. Elk-Stg-ENV -> $SERVER
@Gmanweb
Gmanweb / elasticsearch.md
Created April 12, 2016 09:02 — forked from dominicsayers/elasticsearch.md
Configuring ElasticSearch to use less memory

What I actually did

/etc/security/limits.conf

elasticsearch hard memlock 100000

/etc/default/elasticsearch