Skip to content

Instantly share code, notes, and snippets.

View ramazanpolat's full-sized avatar

Ramazan Polat ramazanpolat

View GitHub Profile
@ramazanpolat
ramazanpolat / chooseWithChance.cs
Last active December 9, 2017 21:40
chooseWithChance.cs - Choose a random member of a set with a given chance of selection.
public static Random random = new Random(DateTime.Now.Millisecond);
public int chooseWithChance(params int[] args)
{
/*
* This method takes number of chances and randomly chooses
* one of them considering their chance to be choosen.
* e.g.
* chooseWithChance(1,99) will most probably (%99) return 1 since index of 99 is 1
* chooseWithChance(99,1) will most probably (%99) return 0 since index of 99 is 0
* chooseWithChance(0,100) will always return 1.
@ramazanpolat
ramazanpolat / genfile.sh
Last active December 26, 2015 22:09
This script generates random file names with random contents.
if [ $# -ne 3 ]
then
echo "This script generates random file names with random contents"
echo "USAGE : $0 [prefix] [size] [count]"
echo " prefix : prefix of file name to be generated"
echo " size : size of the file eg. 2048, 100k, 13M"
echo " count : number of files to be generated"
echo "EXAMPLE:"
echo " $0 tmp 10k 3"
echo " will generate 3 files having size of 10 KBytes each and named something like:"
@ramazanpolat
ramazanpolat / db2useradd.sh
Created November 6, 2013 00:45
This script generates linux users which CAN NOT login to shell but CAN change his/her password with SSH." It is ideal to have those type of users if you are using softwares using OS authentication (eg. IBM DB2)"
#!/bin/bash
if [ $# -eq 0 ]
then
echo "This script generates linux users which CAN NOT login to shell but CAN change his/her password with SSH."
echo "It is ideal to have those type of users if you are using softwares using OS authentication (eg. IBM DB2)"
echo "USAGE : $0 {username} "
echo " username : prefix of file name to be generated"
echo "EXAMPLE:"
echo " $0 "
echo "Author: Ramazan POLAT - [email protected]"
@ramazanpolat
ramazanpolat / mongod
Last active December 28, 2015 01:39
MongoDB init script for SLES. Put your mongodb binary files in: /usr/local/mongodb/ Save this file as "mongod". # cp mongod /etc/init.d/ # chmod +x /etc/init.d/mongod # cp mongod.conf /etc/ # chkconfig --add mongod # service mongod {start|stop|restart|status} Original : https://build.opensuse.org/package/view_file/server:database/mongodb?file=mo…
#!/bin/sh
# Copyright (c) 1995-2004 SUSE Linux AG, Nuernberg, Germany.
#
# Author: Andreas Schneider <[email protected]>
#
# /etc/init.d/mongodb
# and its symbolic link
# /(usr/)sbin/rcmongodb
#
# Template system startup script for some example service/daemon mongodb
@ramazanpolat
ramazanpolat / mongodb.conf
Created November 12, 2013 00:27
Sample MongoDB configuration file.
# mongo.conf
dbpath = /data/db
#port = 27017
#
#where to log
logpath = /var/log/mongodb.log
logappend = true
rest = true
@ramazanpolat
ramazanpolat / tokumx.conf
Created November 12, 2013 00:28
Sample TokuMX configuration file.
# tokud.conf
dbpath = /data/mx
port = 37017
#
#where to log
logpath = /var/log/tokumx.log
logappend = true
rest = true
START_DATE=`date`
SOURCE_DIR=/RMData/lbosdata/00001/
DEST_DIR=/RMData_new/lbosdata/00001/
echo "Source Dir:$SOURCE_DIR"
echo "Destination Dir:$DEST_DIR"
read -p "Press any key to continue, CTRL+C to break ..."
cd $SOURCE_DIR
DIRS=`find ./ -type d | tail -n 100 | sort`
public class MoUtils
{
private static readonly Random random = new Random();
public DataTable MergeDataTable(DataTable dt1, DataTable dt2)
{
DataTable dtMerged = new DataTable();
foreach (DataColumn dc in dt1.Columns)
{
dtMerged.Columns.Add(dc.ColumnName, dc.DataType);
@ramazanpolat
ramazanpolat / designer.html
Last active August 29, 2015 14:14
designer
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<polymer-element name="my-element">
<template>
@ramazanpolat
ramazanpolat / webpack.config.js
Created October 8, 2017 03:38 — forked from learncodeacademy/webpack.config.js
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"