Skip to content

Instantly share code, notes, and snippets.

View madis's full-sized avatar
🧑‍💻
code mode

Madis Nõmme madis

🧑‍💻
code mode
View GitHub Profile
@madis
madis / docker_findings.md
Created May 7, 2014 09:31
Docker findings

Gettings started with OS X, Vagrant & VirtualBox

  1. Create empty box with veewee You should have newest VirtualBox & Vagrant installed.
gem install veewee
veewee vbox define 'ubuntu-14.04-server' 'ubuntu-14.04-server-amd64' --workdir=/Users/madis/infra/veewee
# Change your box (e.g. add memory, it has 512MB by default)
veewee vbox build 'ubuntu-14.04-server' --workdir=/Users/madis/infra/veewee
#!/usr/bin/env ruby
require 'ruby-mass' # gem install ruby-mass
NUMBER_OF_RUNS = 30
# No OOP in here :) Just some small snippets for measuring show Ruby's GC
# collects finished Thread objects. A question that popped up at Fortumo
# party.
def report_object_count
@madis
madis / kernel-patch.patch
Created August 4, 2014 07:53
Parallels kernel patch
diff -Nru prl_fs.orig/SharedFolders/Guest/Linux/prl_fs/inode.c prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c
--- prl_fs.orig/SharedFolders/Guest/Linux/prl_fs/inode.c 2013-11-11 17:56:58.000000000 +0200
+++ prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c 2013-11-29 20:41:53.689167040 +0200
@@ -199,10 +199,18 @@
if (attr->valid & _PATTR_MODE)
inode->i_mode = (inode->i_mode & S_IFMT) | (attr->mode & 0777);
if ((attr->valid & _PATTR_UID) &&
- (sbi->plain || sbi->share || attr->uid == -1))
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+ (sbi->plain || sbi->share || __kuid_val(attr->uid) == -1))
@madis
madis / ad_hoc_webrtc.js
Created March 18, 2015 09:17
Ad-hoc mini WebRTC example
getUserMedia({video: true, audio: true}, function(stream) {window.zeStream = stream}, function() {})
function makeLogger(message) {
return function(data) {
console.log(message, data)
}
}
function attachStream(event) {
@madis
madis / data_uri_to_blob.js
Created May 14, 2015 08:26
Data URI to Blob
// From http://stackoverflow.com/questions/6850276/how-to-convert-dataurl-to-file-object-in-javascript
function dataURItoBlob(dataURI) {
if(typeof dataURI !== 'string'){
throw new Error('Invalid argument: dataURI must be a string');
}
dataURI = dataURI.split(',');
var type = dataURI[0].split(':')[1].split(';')[0],
byteString = atob(dataURI[1]),
byteStringLength = byteString.length,
arrayBuffer = new ArrayBuffer(byteStringLength),
@madis
madis / getUserMediaBug.js
Created June 11, 2015 17:06
Firefox getUserMedia bug with quick consecutive calls
navigator.mozGetUserMedia({video: true, audio: false}, function(s) {window.zeVideoOnly = s}, function() {}); navigator.mozGetUserMedia({video: true, audio: true}, function(s) {window.zeVideo = s}, function() {})
@madis
madis / bad_input.c
Created May 20, 2012 13:10
Secure programming homework
/**
* Secure programming HW4
* Find all potential vulnerabilities in this C function get_user_input
* Compiling: $ make main
* Running: $ ./main
*/
#include <stdio.h>
#include <stdlib.h> // For malloc
#include <string.h> // For strlen
@madis
madis / lets_install.sh
Created September 24, 2012 21:21
Lets install stuff automatically
#!/bin/bash
echo Doing it now!
@madis
madis / gist:3781480
Created September 25, 2012 12:26
Konkreetne vs Abstraktne
Konkreetne							|	Abstraktne
====================================================
roheline							- värv
Clojure								- programmeerimiskeel
minu iPhone, praegusel ajahetkel 	- lihtsalt telefon
Juku								- loll
Programmeerija firmas X				- töökoht
@madis
madis / check_dependencies.sh
Created September 25, 2012 19:22
Is RVM installed?
#!/bin/bash
echo "This script checks if you have all dependencies installed"
# Check for RVM
#RESULT= `type rvm | head -1`
RESULT="rvm is a function"
echo $RESULT
if [[ $RESULT = "rvm is a function" ]]; then
echo "RVM is OK"