Skip to content

Instantly share code, notes, and snippets.

@matejskubic
matejskubic / makecert-azure.bat
Created February 29, 2012 08:51
makecert azure
call :MakeAndExport "Azure Management %1"
call :MakeAndExport "Azure RemoteDesktop %1"
goto exit:
:MakeAndExport
makecert -sky exchange -r -n "CN=%~1" -a sha1 -len 2048 -pe -ss My "%~1.cer"
certutil.exe -user -p "spCertPass-12" -exportPFX -privatekey "%~1" "%~1.pfx"
exit /b 0
:exit
@matejskubic
matejskubic / AutoMapElasticIP.php
Created March 20, 2012 10:30
Maps Elastic IP from AWS EC2 tag AutoMapElasticIP to current instance
<?php
/*
//Required Permissions for IAM
{
"Statement": [
{
"Action": [
"ec2:AssociateAddress",
"ec2:DescribeAddresses",
@matejskubic
matejskubic / solr-exampledocs-post.bat
Created May 22, 2012 20:36
post batch script for Solr examples for windows
@echo off
setlocal
set URL=http://localhost:8983/solr/update
FOR %%a IN (%1) DO (
echo Posting file %%a to %URL%
curl %URL% --data-binary @%%a -H "Content-type:application/xml"
)
curl %URL% --data-binary "<commit/>" -H "Content-type:application/xml"
endlocal
@matejskubic
matejskubic / Windows Live Sts Controller
Created June 22, 2012 14:15
Windows Live Sts That Returns Email, Name Claims
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Web.Mvc;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using Microsoft.IdentityModel.Protocols.WSFederation;
@matejskubic
matejskubic / gist:2973139
Created June 22, 2012 14:41
Twitter Token Service
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.IO;
using System.Web.Mvc;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using Twitterizer;
public static void Configure(HttpConfiguration config) {
config.Formatters.Remove(config.Formatters.XmlFormatter);
config.Formatters.Remove(config.Formatters.FormUrlEncodedFormatter);
// From DefaultContentNegotiator class:
// If ExcludeMatchOnTypeOnly is true then we don't match on type only which means
// that we return null if we can't match on anything in the request. This is useful
// for generating 406 (Not Acceptable) status codes.
config.Services.Replace(
@matejskubic
matejskubic / gist:3756644
Created September 20, 2012 15:35 — forked from jtimberman/gist:883522
chef remove recipe
# As the last resource in the dnsserver::remove_slave recipe, assuming that the remove_slave
# "undoes" a dnsserver slave installation of some kind, without knowing what that might have been.
ruby_block "remove_this_recipe" do
block do
node.run_list.remove("recipe[dnsserver::remove_slave]") if node.run_list.include?("recipe[dnsserver::remove_slave]")
end
action :nothing
end
@matejskubic
matejskubic / gist:4329694
Created December 18, 2012 16:56
oracle - result from table type function
DECLARE
tt PORTAL_INTRANET.T_GK_TABELA;
vv PORTAL_INTRANET.VRSTICA;
--define v_Return PORTAL_INTRANET.T_GK_TABELA;
BEGIN
tt := PORTAL_INTRANET.PKG_PODATKI_GK.F_GET_DATA_GK();
dbms_output.put_line('test_zacetek');
dbms_output.put_line('first:' || tt.first || ' count:' || tt.count || ' last:'||tt.last);
@matejskubic
matejskubic / gist:4485780
Created January 8, 2013 17:21
tempdb transaction log usage
WITH task_space_usage AS (
-- SUM alloc/delloc pages
SELECT session_id,
request_id,
SUM(internal_objects_alloc_page_count) AS alloc_pages,
SUM(internal_objects_dealloc_page_count) AS dealloc_pages
FROM sys.dm_db_task_space_usage WITH (NOLOCK)
WHERE session_id <> @@SPID
GROUP BY session_id, request_id
)
[[email protected]:~]
$ traceroute 216.81.59.173
traceroute to 216.81.59.173 (216.81.59.173), 64 hops max, 52 byte packets
1 wireless_broadband_router (192.168.1.1) 4.116 ms 0.904 ms 0.913 ms
2 l100.bstnma-vfttp-101.verizon-gni.net (98.110.164.1) 6.852 ms 8.155 ms 9.306 ms
3 g4-3-1801.bstnma-lcr-08.verizon-gni.net (130.81.110.44) 7.124 ms 9.601 ms 9.414 ms
4 so-0-3-0-0.bos-bb-rtr2.verizon-gni.net (130.81.29.254) 7.097 ms 9.724 ms 10.282 ms
5 ge-1-2-0-0.ny325-bb-rtr2.verizon-gni.net (130.81.17.24) 18.991 ms 14.711 ms 14.847 ms
6 0.xe-2-0-8.xt2.nyc4.alter.net (152.63.6.253) 22.222 ms 96.148 ms 38.804 ms
7 tengige0-6-1-0.gw8.nyc4.alter.net (152.63.21.113) 19.362 ms