Skip to content

Instantly share code, notes, and snippets.

@ertugrultas
ertugrultas / gitCleanLocalBranches.gradle
Created May 30, 2016 09:04
Git Clean Local Branches
task gitCleanLocal{
doLast{
def local="git branch".execute()
def remote = "git branch -r".execute()
def remoteBranches=remote.text
local.in.splitEachLine(" "){
line ->
if(line[2]!= null && !remoteBranches.contains(line[2])){
("git branch -d "+line[2]).execute()
println "deleted:"+line[2]
@ertugrultas
ertugrultas / Elasticsearch edge ngram index
Created December 24, 2014 22:24
Elasticsearch edge ngram index
{
"settings": {
"number_of_shards": 1,
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
@ertugrultas
ertugrultas / Refresh_MVIEWS.sql
Created December 11, 2013 12:55
A script to refresh materialized views of specific owner.
SET SERVEROUTPUT ON;
DECLARE
cursor c1 is
select * from all_mviews where OWNER=<OWNER NAME>;
BEGIN
FOR mview in c1
LOOP
DBMS_SNAPSHOT.REFRESH(mview.mview_name,'C');
DBMS_OUTPUT.PUT_LINE(mview.mview_name || ' refreshed.');
@ertugrultas
ertugrultas / JAVA keytool untrusted certificate registry Command
Created December 6, 2013 14:17
JAVA keytool untrusted certificate registry
keytool -import -alias kb -keystore "c:\Program Files\Java\jdk1.7.0_02\jre\lib\security\cacerts" -file c:\certificate.cer
@ertugrultas
ertugrultas / C# http post example.cs
Last active December 30, 2015 01:59
EasySocket C# http post example
String uri = "http://api.easysocket.io";
//Do not forget to assign your private key
String privateKey="";
String parameters ="privateKey="+privateKey+"data=Hello World!";
var req = WebRequest.Create(uri);
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
var bytes = Encoding.ASCII.GetBytes(parameters);
req.ContentLength = bytes.Length;
@ertugrultas
ertugrultas / Php http post example.php
Last active December 30, 2015 01:58
EasySocket PHP http post example
<?php
$url = 'http://api.easysocket.io';
//Do not forget to assign your private key
$privateKey="";
$fields = array(
'text' => urlencode($_POST["Hello World!"]),
'privateKey'=>$privateKey
);
@ertugrultas
ertugrultas / Java Http Post Example.java
Last active December 30, 2015 01:49
EasySocket JAVA http post example.
try {
String url = "http://api.easysocket.io";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
//Please do not forget to assign your private key
String privateKey="";
String message="Hello World!";
//add reuqest header
con.setRequestMethod("POST");
con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
@ertugrultas
ertugrultas / Proxy
Created November 13, 2013 08:59
Failover Proxy
var fs = require('fs'),
http = require('http'),
path = require('path'),
failoverProxy = require('failover-proxy');
var filePath = path.join(__dirname, 'fillerama.txt');
var badHost = {
host: '127.0.0.1',
port: 7777
@ertugrultas
ertugrultas / Proxy Examle 2
Created November 13, 2013 08:57
Failover Proxy Example 2
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8888, '127.0.0.1');
console.log('Server running at http://127.0.0.1:8888/');
@ertugrultas
ertugrultas / Proxy Example 1
Created November 13, 2013 08:56
Failover Proxy Example1
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(7777, '127.0.0.1');
console.log('Server running at http://127.0.0.1:7777/');