Skip to content

Instantly share code, notes, and snippets.

View bruno-cadorette's full-sized avatar

Bruno Cadorette bruno-cadorette

  • Sherbrooke
View GitHub Profile
@bruno-cadorette
bruno-cadorette / Auto clicker
Last active August 29, 2015 14:23
Press S to start and X to stop
#include "Windows.h"
#include <iostream>
#include <thread>
using namespace std;
void WaitForKey(int vKey)
{
while (!GetAsyncKeyState(vKey));
}
@bruno-cadorette
bruno-cadorette / IpAddress
Created June 19, 2015 04:43
Mask an ip address
import Control.Monad
import Data.Bits
import Data.List
import Data.List.Split
import Data.Word
createMask::Int -> [Word8]
createMask mask = take 4 $ gen mask ++ repeat 0
where
gen mask
@bruno-cadorette
bruno-cadorette / FizzBuzz
Last active August 29, 2015 14:21
fizzbuzz with infinite list, without modulo
fizzbuzz xs =
let
fizz = cycle ["","","fizz"]
buzz = cycle ["","","","","buzz"]
f x i = if null x then show i else x
in
zipWith3 (\fz bz i-> f (fz++bz) i) fizz buzz xs
main = do
putStr $ unlines $ fizzbuzz [1..100]
let rec reverse str =
let a = Console.ReadLine()
if a <> "0" then
reverse a
printfn "%s" str
[<EntryPoint>]
let main argv =
reverse ""
@bruno-cadorette
bruno-cadorette / 12 days of christmas
Last active December 29, 2015 20:19
Microsoft Anna sing: the 12 days of christmas!
open System.Speech.Synthesis
open System
type language = {
presents: string array
line: string
lastPrefix: string
suffix: int->string
}
@bruno-cadorette
bruno-cadorette / CheckBoxListFor.cs
Created May 24, 2013 02:07
MVC 3 checkbox list for
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Linq.Expressions;
public static class CheckBoxListForExtensions
{
public static MvcHtmlString CheckBoxListFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, SelectList selectList)