Skip to content

Instantly share code, notes, and snippets.

DBCC opentran
KILL [server process ID]
wget --proxy 0.0.0.0:8080 --no-check-certificate %1
@andrijac
andrijac / timestamp.bat
Created January 5, 2015 07:30
Batch script to create timestamp in format yyyyMMdd_HHmm
:: script will generate timestamp in format yyyyMMdd_HHmm
echo off
set hr=%time:~0,2%
if "%hr:~0,1%" equ " " set hr=0%hr:~1,1%
set timestamp=OptionalPrefix_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%
echo.
echo generated timestamp: %timestamp%
echo.
pause
@andrijac
andrijac / get_size.sql
Created February 23, 2015 12:38
Get size of all tables in database
-- http://stackoverflow.com/a/7892349/84852
SELECT
t.NAME AS TableName,
s.Name AS SchemaName,
p.rows AS RowCounts,
SUM(a.total_pages) * 8 AS TotalSpaceKB,
SUM(a.used_pages) * 8 AS UsedSpaceKB,
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
FROM
sys.tables t
@andrijac
andrijac / restore.reg
Created June 1, 2015 11:21
Restore .bat files as executables
Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat]
[-HKEY_CURRENT_USER\Software\Classes\.bat]
[-HKEY_CURRENT_USER\SOFTWARE\Classes\batfile]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.bat]
@="batfile"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\open\command]
@andrijac
andrijac / static_page_search.md
Last active August 29, 2015 14:23
quick static page search

Assumtions:

  • All static pages are in top folder. File search is being done root folder and URL generated in search results.
  • Search.aspx is skipped
  • Search is being done on *.aspx files
@andrijac
andrijac / read__all_vars.js
Last active August 29, 2015 14:23
Read all variables in browser
// chrome 43.0.2357.124 m
// probably contains some plugin fluff
var vanilla = ['top'
,'location'
,'document'
,'window'
,'external'
,'chrome'
,'_gaUserPrefs'
,'DoodleNotifier'
            /\_/\
       ____/ o o \
     /~____  =ø= /
    (______)__m_m)

Order of execution:

  • create_list.bat - create a list of files in both source and target.
  • TextFileDiff.cs - create diff with file lists
  • CopyGen.cs - create copy file (executable) from diff file.
@andrijac
andrijac / extends.js
Created July 14, 2015 21:36
Javascript method and extends
Function.prototype.method = function(name, func) {
this.prototype[name] = func;
return this;
}
Function.prototype.extends = function(superclass) {
this.prototype = Object.create(superclass.prototype);
this.prototype.constructor = this;
}
@andrijac
andrijac / gist:1296731
Created October 18, 2011 21:08 — forked from dshaw/gist:378192
(function(window,document,undefined){ ... })(this,this.document);
// everyone's new favorite closure pattern:
(function(window,document,undefined){ ... })(this,this.document);
// when minified:
(function(w,d,u){ ... })(this,this.document);
// which means all uses of window/document/undefined inside the closure
// will be single-lettered, so big gains in minification.
// it also will speed up scope chain traversal a tiny tiny little bit.