Skip to content

Instantly share code, notes, and snippets.

View Luiz-Monad's full-sized avatar
💭
computing

Luiz Luiz-Monad

💭
computing
View GitHub Profile
/*
[DESAFIO / LANGUAGE WAR] Implemente um programa na sua linguagem favorita onde o usuário digita um número x, e o programa calcula o somatório dos x primeiros números pares da sequência fibonacci, e imprime a soma dos algarismos desse número.
Por exemplo, quando x = 5, a resposta é 17, pois:
1. A sequência fibonacci é 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233,...
2. Os 5 primeiros números pares são 0, 2, 8 e 34, 144.
3. O somatório disso é 188.
4. Somando os algarismos, 1+8+8 = 17
-- Function: clone_schema(text, text, text)
-- DROP FUNCTION clone_schema(text, text, text);
CREATE OR REPLACE FUNCTION clone_schema(source_schema text, dest_schema text, dest_owner text)
RETURNS void AS
$BODY$
DECLARE
seq RECORD;
#Creates a named function using the script block.
function Add-Function(
[string]$name,
[Parameter(ValueFromPipeline=$true)]
[ScriptBlock]$block)
{
New-Item -Path "Function:" -Name "global:$name" -Value $block
}
Penetration Testing Execution Standard
http://www.pentest-standard.org/index.php
ISIS Lab's Hack Night - An Intense Introduction to Offensive Security
https://github.com/isislab/Hack-Night/
FSU Offensive Computer Security
http://www.cs.fsu.edu/~redwood/OffensiveComputerSecurity ( 2014 )
http://www.cs.fsu.edu/~redwood/OffensiveSecurity ( 2013 )
@Luiz-Monad
Luiz-Monad / gist:2466dc1aca84a3a02357
Created October 14, 2015 19:17
powershell build
$packages = (git diff --name-only $env:TRAVIS_COMMIT_RANGE) |
? { $_ -like "conda/*" } |
% { $_ | split-path -leaf } |
group | % { $_.name }
write-host "Packages to be built: $packages"
foreach ( $pkg in $packages )
{
foreach ( $python in $env:PYTHON )
{
conda build "conda/$pkg" --python $python
@Luiz-Monad
Luiz-Monad / peano.cpp
Created January 8, 2016 21:58
Peano numbers with constexpr metaprogramming (yet another implementation)
template<typename T>
struct S {
typedef T Previous;
enum { ToInt = T::ToInt + 1 };
};
struct Z { enum { ToInt = 0 }; };
template<typename T>
@Luiz-Monad
Luiz-Monad / peano_complex.cpp
Last active October 22, 2016 20:25
peano_complex.cpp
//Lets create an arithmetic by using templates, why not?
//We're not allowed to use builtin compiler math operations
//Yes, this uses sifinae
struct Z {
enum { ToInt = 0 };
};
template<typename T>
struct S {
input:not(:checked) + input:not(:checked) + input:not(:checked) + input:checked +
div:before {
content: "1";
}
input:not(:checked) + input:not(:checked) + input:checked + input:not(:checked) +
div:before {
content: "2";
}
input:not(:checked) + input:not(:checked) + input:checked + input:checked +
div:before {
@Luiz-Monad
Luiz-Monad / profunctor.cs
Last active December 5, 2016 23:53
A Profunctor is just a bifunctor that is contravariant in the first argument and covariant in the second. What's the problem?
//https://ocharles.org.uk/blog/guest-posts/2013-12-22-24-days-of-hackage-profunctors.html
//http://blog.sigfpe.com/2011/07/profunctors-in-haskell.html
//https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/profunctors
public interface Variant { }
public interface CoVariant { }
public interface Profunctor<P>
{
P p { get; }
@Luiz-Monad
Luiz-Monad / sort_by_pk.cs
Last active December 7, 2016 19:47
EF PK sort
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Data.Entity.Core;
using System.Data.Entity.Core.Mapping;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Core.Objects.DataClasses;
using System.Data.Entity.Infrastructure;
using System.Data.Linq;