Skip to content

Instantly share code, notes, and snippets.

Avatar

Mustafa Akın mustafaakin

View GitHub Profile
@mustafaakin
mustafaakin / fibo-js
Created Feb 11, 2012
Fibonacci Calculation - JS
View fibo-js
function fibonacci(n) {
if (n < 2)
return 1;
else
return fibonacci(n-2) + fibonacci(n-1);
}
fibonacci(40);
@mustafaakin
mustafaakin / gist:2083326
Created Mar 18, 2012
Basic-PHP MySQL Code
View gist:2083326
<?php
$host = "localhost";
$username = "root";
$password = "123";
$db_name = "test";
$db=mysql_connect($host, $username, $password) or die('Could not connect');
mysql_select_db($db_name, $db) or die('no db');
$sth = mysql_query("SELECT * FROM sample s");
$rows = array();
View app.js
var express = require('express');
var http = require('http');
var path = require('path');
var fs = require("fs");
var jade = require("jade");
var app = express();
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
View index.jade
mixin func1(id, content)
.col
p= content
a(href="/view/#{id}") Click to Read More
p Test
i Indentation
b is Cool
i But not that cool
b Can slow down execution
i oh for real?
@mustafaakin
mustafaakin / README.md
Last active Aug 17, 2020
Running Windows Server 2k16 with Docker under Linux, KVM or Virtualbox
View README.md

Are you let down when you saw there is no guide to use Windows Server 2016 under *nix environments? I really loved Microsoft when I heard they are working on Windows containers, but when this week has arrived, it was sad to see that installation requirements were Windows and HyperV. But actually it is not. You just have to modify the VHD file a bit with nicer tools and execute the already available script in the downloaded VM. I will assume you are running a decent version of Linux and accepted EULA and all the legal stuff that I do not care.

1. Getting the required tools:

$ sudo apt-get install qemu-kvm virt-manager // or virtualbox, but we need qemu-kvm for image manipulation
$ sudo apt-get install qemu-utils libguestfs-tools // image manipulation tools

2. Downloading files

View purge-facebook.js
function perform() {
console.log("Finding button")
$($("._4xev")[1]).click();
setTimeout(function() {
$(".uiContextualLayer").each(function() {
var b = $(this).is(':visible');
if (b) {
var t = $(this).find("._54nh");
var a = {};
t.each(function() {
@mustafaakin
mustafaakin / docker-compose.yml
Last active Jul 20, 2016
ShareLatex Docker Compose
View docker-compose.yml
version: '2'
services:
redis:
image: redis:3
mongo:
image: mongo:2.6
restart: always
volumes:
- "./data/mongo:/data/db"
View medium-swarm-netbench.sh
# Create Key Store Node
docker-machine create -d virtualbox mh-keystore-vb
docker $(docker-machine config mh-keystore-vb) run -d \
-p "8500:8500" \
-h "consul" \
progrium/consul -server -bootstrap
# Create Primary Node
docker-machine create \
-d virtualbox \
View medium-swarm-netbench2.sh
// replace it with your own token
TOKEN=aaa12a00f2f264727a4c5436c070d58477cd6d5f13a0379955901c4a962e9ee2
# Create Key Store Node
docker-machine create --driver digitalocean \
--digitalocean-access-token=$TOKEN \
--digitalocean-region=ams3 mh-keystore-do
docker $(docker-machine config mh-keystore-do) run -d \
-p "8500:8500" \
-h "consul" \
View medium-swarm-netbench-3.sh
$ eval $(docker-machine env --swarm mhs-demo0-vb)
$ docker info
Containers: 60
Images: 7
Role: primary
Strategy: spread
Filters: health, port, dependency, affinity, constraint
Nodes: 2
mhs-demo0-vb: 192.168.99.101:2376
└ Containers: 16
You can’t perform that action at this time.