Skip to content

Instantly share code, notes, and snippets.

View gousiosg's full-sized avatar

Georgios Gousios gousiosg

View GitHub Profile
@gousiosg
gousiosg / stackoverflow.sql
Last active December 6, 2023 22:12
Script to import the stackexchange dumps into MySQL
# Copyright (c) 2013 Georgios Gousios
# MIT-licensed
create database stackoverflow DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
use stackoverflow;
create table badges (
Id INT NOT NULL PRIMARY KEY,
UserId INT,
@gousiosg
gousiosg / teapot.php
Created October 7, 2013 17:16
The teapot in PHP!
<?php
class Triangle
{
var $colors = array("yellowgreen", "tomato", "plum");
var $vertices;
function Triangle($vertices)
{
assert(sizeof($vertices) == 3);
select a.month,
a.total_commits - b.commits_from_pull_reqs as direct,
b.commits_from_pull_reqs as pullreq
from
(select strftime("%Y-%m-01", substr(c.created_at, 0, 20)) as month,
p.id as prid, count(c.id) as total_commits
from commits c, projects p, project_commits pc
where p.id = pc.project_id
and c.id = pc.commit_id
group by month, p.id) as a,
@gousiosg
gousiosg / VanityPullRequests.cs
Last active December 15, 2015 16:39
Find Github pull requests that are then tweeted. Implemented with Rx.Net in C#.
/*
* Github commits that are then tweeted.
* by @gousiosg, @headinthebox
*/
void Main()
{
var q = from ghinfo in PullRequestersInfo()
from u in ghinfo
from t in Tweets(u).TakeUntil(Observable.Timer(TimeSpan.FromMinutes(5)))
select new {User = u, Tweet = t};
@gousiosg
gousiosg / RxPortScan.scala
Last active December 15, 2015 12:59
A reactive port scanner written using Rx.Java (0.13 onwards) and Scala 2.10 Futures
import java.net.Socket
import rx.subscriptions.Subscriptions
import rx.lang.scala.Observable
import scala.concurrent.{Future, future}
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.{Failure, Success}
// A reactive parallel port scanner written with Rx.Java
// @author: @gousiosg, @headinthebox