Skip to content

Instantly share code, notes, and snippets.

View ma-he-sh's full-sized avatar
⚙️
Focusing

Mahesh Ranaweera ma-he-sh

⚙️
Focusing
View GitHub Profile
<?php
$a1 = $_POST ["a"];
$b1 = $_POST ["b"];
$c1 = $_POST ["c"];
$d1 = $_POST ["d"];
$e1 = $_POST ["e"];
echo "<p>Greetings $a1 $b1</p>";
echo "<p>Your User name is: $c1 and your password is: $d1</p>";
echo "<p>Your cellphone number is: $e1</p>";
@ma-he-sh
ma-he-sh / check_user.js
Last active May 4, 2017 02:38
Rethinkdb check whether user exists and if not insert
var email = 'test@email.com';
r.db('dbname').table('users')
.get(email)
.run()
.then(function (response) {
if (response == null) {
//console.log('User Not exists');
@ma-he-sh
ma-he-sh / retrieve.js
Created May 11, 2017 13:42
callback and promises to return data from rethinkdb
//db_query.js
//send group data
var retrieve_group = function(r, connection, gid, req, res, session, callback) {
r.db(dbname).table(tbgroup).get(gid).run()
.then(function(response) {
//console.log('deleted');
callback(response);
})
.catch(function(err) {
@ma-he-sh
ma-he-sh / UE4.desktop
Created June 2, 2017 04:26
UnrealEngine4 Linux Desktop Icon
[Desktop Entry]
Version=1.0
Type=Application
Name=UE4
Exec="/home/username/UnrealEngine/Engine/Binaries/Linux/UE4Editor"
Categories=Development;Game;
Terminal=false
StartupNotify=true
Name[en_GB]=UE4.desktop
@ma-he-sh
ma-he-sh / index.js
Created June 19, 2017 00:08
ElectronExpressNodeJS
const server = require('./server');
const electron = require('electron');
// Module to control application life.
const {
app
} = electron;
// Module to create native browser window.
const {
BrowserWindow
} = electron;
@ma-he-sh
ma-he-sh / perfectelementary.bash
Created June 19, 2017 18:41
HowTo Install the perfect Elementary-OS
#Download Elementary OS from here:
#http://sourceforge.net/projects/elementaryos/files/stable/
#First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
#Install Google Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
@ma-he-sh
ma-he-sh / config.js
Last active February 7, 2018 06:08
Heroku PostgreSQL SSL Connection, NodeJS
/**Heroku connection credentials */
var dbconnect = {
dbhost: "",
db: "",
dbuser: "",
dbport: "5432",
dbpassw: ""
}
module.exports.dbconnect = dbconnect;

Getting started with Docker

Deploying a simple Node web-application inside a Docker container.

First we need to install Docker on the system. Docker provide great documentation to do that. https://docs.docker.com/install/

Setting up the application folder

# Linux Demo
# Check Docker is installed in the system
@ma-he-sh
ma-he-sh / How to run.md
Last active February 13, 2023 11:02
Install Android Studio on Elementary OS

Installing Android Studio on ElementaryOS

  sudo chmod +x installAndroid.sh
  ./installAndroid.sh
#!/usr/bin/env bash
# My ElementaryOS setup
# Install dependencies
initSETUP (){
echo -e "\e[36m \e[1m [01] Installing Dependencies and Updates \e[0m"
sudo apt-get update && sudo apt-get dist-upgrade
# install elementary-tweaks