Skip to content

Instantly share code, notes, and snippets.

View HeLiBloks's full-sized avatar

Henrik Lindgren HeLiBloks

  • Stockholm
View GitHub Profile
@HeLiBloks
HeLiBloks / squid_commands.sh
Last active May 4, 2016 09:38
Useful squid commands
find . | xargs head -n1 | strings | grep :// > squid-urls.txt #list of urls in squid cache
#purge pattern from cache
for x in `cat squid-urls.txt | grep foo`; do
squidclient -m PURGE $x ;
done
#format the dates
perl -p -e 's/^([0-9\.]*)/"[".localtime($1)."]"/e' *.log
@HeLiBloks
HeLiBloks / Pivot.snippet
Created January 14, 2016 16:52 — forked from craibuc/Pivot.snippet
Sql Server Management Studio (SSMS) 2012, Pivot, surround snippet.
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<_locDefinition xmlns="urn:locstudio">
<_locDefault _loc="locNone" />
<_locTag _loc="locData">Title</_locTag>
<_locTag _loc="locData">Description</_locTag>
<_locTag _loc="locData">Author</_locTag>
<_locTag _loc="locData">ToolTip</_locTag>
<_locTag _loc="locData">Default</_locTag>
</_locDefinition>
@HeLiBloks
HeLiBloks / generate_date.sql
Created January 11, 2016 10:02 — forked from rudiv/generate_date.sql
Generate Date Table SQL Server
-- This will insert X years worth of data into a Date table. All fields are INT apart from DayName and DateTime (NVARCHAR(10) and DATE respectively)
-- Update 19/12 now uses ISO Week Number
-- Define start (base) and end dates
DECLARE @basedate DATETIME = '20111101', @enddate DATETIME = '20150101';
DECLARE @days INT = 0, @date DATETIME = '20110101', @maxdays INT = DATEDIFF(dd, @basedate, @enddate);
WHILE @days <= @maxdays
BEGIN
SET @date = DATEADD(dd, @days, @basedate);
## sed ish
$a -replace "([A-z])(23)","$1,$2"
##seq 1 10
1..10
##loop
for ($i=0;$i -lt 10; $i++) { echo $i }
##copy files recursive