Skip to content

Instantly share code, notes, and snippets.

using System.Collections.Generic;
using System.Linq;
// https://www.nuget.org/packages/TestStack.White
using TestStack.White;
using TestStack.White.UIItems;
using TestStack.White.UIItems.Finders;
namespace MTBacktester
{
@shturm
shturm / BashCheatsheet.md
Last active August 25, 2016 10:56
BashCheatsheet

Bash Cheatsheet

Rename recursively extensions of files

Change OldExtension and NewExtension :

find . -type f -name *.mqh -exec sh -c 'mv "$1" "${1%.OldExtension}.NewExtension"' _ {} \;

using System;
using System.Text;
using System.Runtime.InteropServices;
using RGiesecke.DllExport; // https://www.nuget.org/packages/UnmanagedExports - required for the functions to be consumed by native code
namespace Testme
{
class Test
{

Restore a complete copy of the SSD (sda device)

gunzip -c /media/data/IMAGE_NAME.img.tgz | dd of=/dev/sda

Create and compress complete backup of sda (the SSD) disk

dd if=/dev/sda conv=sync,noerror bs=1k | gzip -c > IMAGE_NAME.img.tgz

Remove LVM the snapshot

sudo lvremove /dev/ubuntuvg/rootsnap

Create LVM snapshot

@shturm
shturm / makeself-exec.sh
Created January 26, 2016 10:14
Execute makeself script from anywhere (https://github.com/megastep/makeself)
MAKESELFPATH=/home/alx/bin/makeself
PAYLOADFOLDER=$(readlink -e $1)
OUTPUTFILENAME=$(pwd)/$2
LABEL=$3
INSTALLER=$(readlink -e $4)
cd $MAKESELFPATH
echo "Executing: sh makeself.sh $PAYLOADFOLDER $OUTPUTFILENAME $LABEL $INSTALLER"
sh makeself.sh $PAYLOADFOLDER $OUTPUTFILENAME $LABEL $INSTALLER
# Restore a complete copy of the SSD (sda device)
gunzip -c /media/data/IMAGE_NAME.img.tgz | dd of=/dev/sda
# Create and compress complete backup of sda (the SSD) disk
dd if=/dev/sda conv=sync,noerror bs=1k | gzip -c > IMAGE_NAME.img.tgz
# Remove LVM the snapshot
sudo lvremove /dev/ubuntuvg/rootsnap
# Create LVM snapshot
@shturm
shturm / index.js
Created September 16, 2015 11:53
NodeJS HTTP Server
//Lets require/import the HTTP module
var http = require('http');
//Lets define a port we want to listen to
const PORT=8080;
//We need a function which handles requests and send response
function handleRequest(request, response){
response.end('It Works!! Path Hit: ' + request.url);
}
@shturm
shturm / index.html
Last active September 1, 2015 14:51 — forked from anonymous/index.html
Ember Testing - Fixtures/Mockjax. Source from: http://jsbin.com/yurope/6
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Ember testing approaches">
<meta charset="utf-8">
<title>Ember Testing</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.js"></script>
<script src="http://builds.emberjs.com/tags/v1.10.0/ember-template-compiler.js"></script>
@shturm
shturm / Preferences.sublime-settings
Created May 16, 2015 15:36
User preferences for sublime - Preferences > Settings - User
{
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
"node_modules",
"bower_components",
"tmp"
function problem4(input) {
var matches = [],
players = [];
// create matches from input
for (var i = input.length - 1; i >= 0; i--) {
var line = input[i];
var match = {
playerA: getFirstPlayer(line),
playerB: getSecondPlayer(line),