This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Created by: Amir | |
# Date: 14 December 2012 | |
# Description: Check Win Service to see if it is running and start it otherwise | |
# Usage: powershell -Command "C:\Scripts\serviceMonitor.ps1 | Out-File C:\Scripts\ServiceMonitor.txt -append" | |
$serviceName = "SampleServiceName" | |
$service = Get-Service | Where-Object { $_.Name -eq $serviceName } | |
write-host "Service Status is" $service.status | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url:'http://your/url', | |
data:{ apikey: 'secret-key-or-any-other-parameter-in-json-format' }, | |
dataType:'json', | |
success:function (data) {alert(data.first_name);} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url:'http://your/url?callback=?', | |
data:{ apikey: 'secret-key-or-any-other-parameter-in-json-format' }, | |
dataType:'jsonp', | |
crossDomain: 'true', | |
success:function (data) {alert(data.first_name);} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StreamManager | |
{ | |
private const int BufferLength = 1024; | |
/// <summary> | |
/// Receives the sourceStream from service and iterate until end of the stream | |
/// </summary> | |
/// <param name="sourceStream">Source stream</param> | |
/// <returns>Memory stream</returns> | |
public MemoryStream ReadStream(Stream sourceStream) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Data.Services.Client; | |
using System.Data.Services.Common; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ODataSampleClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ReflectionHelper | |
{ | |
public static T CreateInstance<T>() | |
{ | |
var constructor = Expression.New( typeof(T) ); | |
var instance = (Func<T>)Expression.Lambda(constructor).Compile(); | |
return instance(); | |
} | |
public static T CreateInstance<T>(params object[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
.dv1 { | |
display: block; | |
position: absolute; | |
top: 75px; | |
left: 75px; | |
width:50px; | |
height: 50px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo iptables -t nat -L | |
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
install_mongo() { | |
sudo yum -y update | |
echo "[MongoDB] | |
name=MongoDB Repository | |
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 | |
gpgcheck=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export LANGUAGE=en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 #better not to set this | |
locale-gen en_US.UTF-8 | |
sudo dpkg-reconfigure locales | |
#Better way --> Check the: /etc/default/locale | |
LANG="en_US.UTF-8" | |
LANGUAGE="en_US:en" | |
LC_CTYPE="en_US.UTF-8" | |
LC_NUMERIC="en_US.UTF-8" |
OlderNewer