Skip to content

Instantly share code, notes, and snippets.

@iszlai
iszlai / FileAppendingActor.scala
Created December 13, 2014 20:17
Akka ETL load a folder full of images and save int arrrays to file line by line
package com.strike.etl
import java.io.FileWriter
import akka.actor.Actor
import com.typesafe.config.ConfigFactory
import org.slf4j.LoggerFactory
/**
* Created by Lehel on 12/13/2014.
@iszlai
iszlai / gist:494128e7967ac0d475f9
Created December 28, 2014 20:31
Dot product calc
def dot(first: Array[Array[Double]], second: Array[Int]): Array[Double] = {
val result = new Array[Double](first.size)
for (i <- 0 to (first.size - 1)) {
result(i) = dotProduct(first(i), second)
}
return result
}
def dotProduct(first: Array[Double], second: Array[Int]): Double = {
require(first.size == second.size)
@iszlai
iszlai / gist:52da08584a6977a639be
Created December 30, 2014 12:08
Scala functional vs imperative
object Dot {
def main(args: Array[String]) {
println("Imperative")
val startTime = System.nanoTime()
testImperative()
val endTime = System.nanoTime()
println((endTime - startTime) / 1000000 + "\n")
namespace Sagas
{
using System;
using System.Collections.Generic;
class Program
{
static ActivityHost[] processes;
@iszlai
iszlai / gist:f3af3da6eb0c8d3673d6
Created June 17, 2015 13:29
BartoszMilewski - Composition is the Essence of Programming - Challenges
object Category {
//Implement, as best as you can, the identity function in your favorite language
// (or the second favorite, if your favorite language happens to be Haskell).
def id[A]( a:A ):A=a; //> id: [A](a: A)A
//Implement the composition function in your favorite language.
@iszlai
iszlai / turing-tweet.js
Last active August 29, 2015 14:27
A tweetable turing machine
/**
* Here's a turing machine that fits into a tweet with an example program.
* Original tweet: https://twitter.com/mrrrgn/status/630419814666780673
* Gif: http://i.imgur.com/4t31zA2.gif
* Turing machines: https://www.youtube.com/watch?v=dNRDvLACg5Q
*
* Think this is neat? Consider following me for more computer silliness:
* twitter.com/mrrrgn or rss my blog linuxpoetry.com
**/
@iszlai
iszlai / day6.ex
Created December 28, 2015 15:48 — forked from petrikero/day6.ex
defmodule Benchmark do
def measure(function) do
elapsed = function
|> :timer.tc
|> elem(0)
|> Kernel./(1_000_000)
IO.puts "Elapsed = #{elapsed}s"
end
end
@iszlai
iszlai / himawari.ps1
Created February 4, 2016 11:24 — forked from MichaelPote/himawari.ps1
Windows Powershell Script to download the latest image from the Himawari-8 satelite, combine the tiles into a single image, convert to jpg and then set as the desktop background.
#
# Himawari-8 Downloader
#
#
#
# This script will scrape the latest image from the Himawari-8 satellite, recombining the tiled image,
# converting it to a JPG which is saved in My Pictures\Himawari\ and then set as the desktop background.
#
# http://himawari8.nict.go.jp/himawari8-image.htm
#
@iszlai
iszlai / Google XSS challenge solutions..
Created November 25, 2016 09:31 — forked from pbssubhash/Google XSS challenge solutions..
Solutions of the Google XSS Challenge..
Hey All,
I am P.B.Surya.Subhash, a 17 Year coder,hacker and a student.
Recently I happen to see so many posts regarding this " Google XSS Challenge " and i was fortunate enough to complete them..
These are the solutions for the challenges ;)
##############################################################################
Level 1: Hello, world of XSS
https://xss-game.appspot.com/level1/frame
query=<script>alert('xss')</script>
@iszlai
iszlai / Main.java
Created December 17, 2017 17:39 — forked from tazjin/Main.java
Playing with Prometheus Java client
import io.prometheus.client.*;
import io.prometheus.client.exporter.common.TextFormat;
import io.prometheus.client.hotspot.DefaultExports;
import spark.Request;
import spark.Response;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Random;