Skip to content

Instantly share code, notes, and snippets.

View olivier-spinelli's full-sized avatar

Olivier Spinelli olivier-spinelli

View GitHub Profile
@olivier-spinelli
olivier-spinelli / Javascript.Obfuscation
Created November 18, 2014 08:16
Find the password...
<html>
<head>
<script>
$ = ~[];$={___:++$,$$$$:(![]+"")[$],__$: ++$,$_$_:(![]+"")[$],_$_:++$,$_$$:
({} + "")[$],$$_$:($[$] + "")[$],_$$: ++$,$$$_:(!"" + "")[$],$__:++$,$_$:
++$,$$__:({}+"")[$],$$_:++$,$$$:++$,$___: ++$,$__$:++$,$__$__$:(++$[$]+"")
[0]};$.$_=( $.$_ = $ + "" )[$.$_$]+($._$=$.$_[$.__$])+( $.$$ =($.$+"")
[$.__$])+(!$ +"")
[$._$$]+( $.__=$.$_[$.$$_])+($.$=(!""+"")[$.__$]) + ($._=
(!"" +"" )[$._$_]) + $.$_[$.$_$]+$.__+$._$+ $.$;$.$$=$.$+(!""+"" )[$._$$]
@olivier-spinelli
olivier-spinelli / TSql.NotReserved.sql
Last active December 17, 2015 08:08
These are NOT reserved keywords...
-- max, output, readonly are NOT reserved keywords.
-- Type names are not reserved: following column names are legal.
create table tTestLMax( max int, output int, readonly int, int int, datetime int );
select max, output, readonly, int, datetime from tTestLMax;
@olivier-spinelli
olivier-spinelli / TSql.StatementTerminator.sql
Last active December 15, 2015 09:38
T-Sql statement terminator.
-- Then statement of a if can be terminated by ;
if 0 = 1 print 'boo';
else print 'murf';
-- ; can appear after a end. Any number of times (empty statements).
if 0 = 1
begin
print 'boo';
end;
else
@olivier-spinelli
olivier-spinelli / TSql.ExploringLiterals.AllTypes.sql
Last active December 12, 2015 01:29
How are T-Sql literals parsed?
select [ ]=1, [Val] = '0', Type = cast(sql_variant_property(0,'BaseType') as varchar(20)), [Precision]=cast(sql_variant_property(0,'Precision') as varchar(20)), [Scale]= cast(sql_variant_property(0,'Scale') as varchar(20)), [MaxLength] = cast(sql_variant_property(0,'MaxLength') as varchar(20))
union
select 2, '35', cast(sql_variant_property(35,'BaseType') as varchar(20)), cast(sql_variant_property(35,'Precision') as varchar(20)), cast(sql_variant_property(35,'Scale') as varchar(20)), [MaxLength] = cast(sql_variant_property(35,'MaxLength') as varchar(20))
union
select 3, '''str''', cast(sql_variant_property('str','BaseType') as varchar(20)), cast(sql_variant_property('str','Precision') as varchar(20)), cast(sql_variant_property('str','Scale') as varchar(20)), [MaxLength] = cast(sql_variant_property('str','MaxLength') as varchar(20))
union
select 4, 'N''str''', cast(sql_variant_property(N'str','BaseType') as varchar(20)), cast(sql_variant_property(N'str','Precision') as varchar(20)), cast(sql_variant_proper
-- This can be executed (star comments may occur between name parts).
create view [dbo]/*C1*/./*C2*/vTest
as
select * from sys.tables;
GO
-- The view is correctly created...
select * from dbo.vTest;
select * from dbo/*C*/./*C*/vTest;
GO
-- But... this is what is generated :-).