Skip to content

Instantly share code, notes, and snippets.

View gousiosg's full-sized avatar

Georgios Gousios gousiosg

View GitHub Profile
@gousiosg
gousiosg / decrypt.py
Created February 9, 2024 10:14
Encryption / Decryption for kinds experiments
#!/usr/bin/env python3
# (c) 2019 Georgios Gousios <gousiosg@gmail.com>
#
# Teaching encryption to kids
import sys
from encryption import KEY
INVERTED_KEY = {value: key for key, value in KEY.items()}
@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 / README.md
Last active November 8, 2023 05:20
Restoring the GHTorrent MongoDB database

This is a collection of scripts to restore a full GHTorrent MongoDB database from the dumps available at http://ghtorrent-downloads.ewi.tudelft.nl.

To do the restore:

  1. Open a MongoDB terminal and run the createCollections.js script to create the necessary collections. You can block_compressor to either snappy or zlib to make your databases compressed. I am using none here, as I am using compression at the filesystem level.

  2. Run restore-cummulative-dumps.sh to restore the cummulative dumps. Wait 3-4 days.

@gousiosg
gousiosg / README.md
Created January 18, 2021 17:54
Obtain a transitive closure for a list of Maven dependencies (including release dates)

Input format example (the date field is not mandatory):

{'groupId': 'org.sonatype.nexus.plugins', 'artifactId': 'nexus-ruby-plugin', 'version': '2.11.4-01', 'date': 1436480633}
{'groupId': 'org.apache.maven.archiva', 'artifactId': 'archiva-site', 'version': '1.0-beta-1', 'date': 1186902008}
{'groupId': 'com.yahoo.vespa', 'artifactId': 'linguistics', 'version': '6.158.42', 'date': 1508227582}
{'groupId': 'org.xwiki.commons', 'artifactId': 'xwiki-commons-repository-api', 'version': '8.0', 'date': 1458055140}

To run:

@gousiosg
gousiosg / session.sh
Last active December 10, 2020 11:43
GHTorrent from scratch session
#First, install RVM as per https://rvm.io
rvm install 2.5.1
rvm use 2.5.1
git clone git@github.com:gousiosg/github-mirror.git
cp config.yaml.standalone config.yaml
# Install dependencies
gem install bundler
@gousiosg
gousiosg / ml4se.bib
Last active December 9, 2020 13:29
My reading list for ML4SE
@article{Alon19,
author = {Alon, Uri and Zilberstein, Meital and Levy, Omer and Yahav, Eran},
title = {Code2Vec: Learning Distributed Representations of Code},
journal = {Proc. ACM Program. Lang.},
issue_date = {January 2019},
volume = {3},
number = {POPL},
month = jan,
year = {2019},
issn = {2475-1421},
@gousiosg
gousiosg / buien-hue.rb
Last active December 9, 2020 10:22
Set color of a Hue lightbulb based on fine-grained rain information
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
require 'hue'
delft="http://www.buienradar.nl/Json/RainForecast3Hours?lat=52.006&lon=4.355&weatherstationid=6344&streetlevel=false"
percipitation = JSON.parse(open(delft).read)['forecasts'][1]["precipation"]
@gousiosg
gousiosg / geocode.rb
Created October 8, 2015 21:27
Geocode a list of addresses using OpenStreetMaps
#!/usr/bin/env ruby
#
require 'open-uri'
require 'json'
require 'pp'
require 'uri'
File.open('locs').each_line do |location|
url=URI.escape("http://nominatim.openstreetmap.org/search/#{location}?format=json&addressdetails=1")
@gousiosg
gousiosg / developer-density.ipynb
Last active November 6, 2020 17:43
Developer density
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gousiosg
gousiosg / rebuild_megaraid.md
Last active February 4, 2020 10:09
Rebuild RAID array when one disk has been marked as faulty (but it is not really)