Skip to content

Instantly share code, notes, and snippets.

# client.rb
require 'socket'
require 'digest/sha1'
require 'json'
hostname = "localhost"
port = 2000
socket = TCPSocket.open(hostname, port)
1.times do |i|
content = "#{i.to_s}: #{ARGV[0].to_s}"
msg = {
@simplay
simplay / cppfoo.cpp
Created January 22, 2016 15:01
Pointers are evil...
#include <iostream>
using namespace std;
int main() {
int i = 10;
int j = i;
int &ai = i;
int *pi = &i;
*pi = *pi + 1;

How to install Boost (1.55 or greater)

On windows 7 or greater

Requirements

  • Visual Studio installed on your system
  • Admin Privileges

Sources

@simplay
simplay / install_rvm_windows.md
Last active November 24, 2015 14:55
install rvm and jruby under windows 7

1 . cygwin installiere (x86 verion (auso nid 64bit)): source: http://cygwin.com/install.html

2 . Cygwin package manager installiere (drmit uf windows in cygwin s gliche wie apt-get uf linux distros chasch mache)

lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin
@simplay
simplay / screen_shortcuts.md
Last active November 21, 2015 14:06
screen keybindings

Screen Keybindings

Definitions

<c-a> := presss control a

Window Management

i1 = [1,2,3,4,5]
i2 = (0...(i1.size-1)).inject([]) {|pairs,x| pairs += ((x+1)...i1.size).map {|y| [i1[x],i1[y]]}}
@simplay
simplay / howto_install_bronx_s_motion_tracking.md
Last active October 23, 2016 18:34
How to install Bronx's motion tracking software

Installation

  • install ubuntu 14.04 LTS (64bit)
  • run sudo apt-get install build-essential
  • download http://lmb.informatik.uni-freiburg.de/resources/binaries/eccv2010_trackingLinux64.zip
  • from: http://lmb.informatik.uni-freiburg.de/resources/software.php
  • unzip downloaded source
  • run make within unzipped folder
  • run the example: ./tracking cars1.bmf 0 20 8
@simplay
simplay / vim_me_tonight.md
Last active August 29, 2015 14:19
all vim steps needed to be done...

... and this is how the story started...

:s/foo/bar/gc replace every foo in a text with bar (confirm after each detected occurrence). goto beginning of a word (move cursor onto its first letter), type v1ey to copy that word and move cursor to target word (its first letter) and type v1ep to overwrite it with copied word (not taht overwritten word is now in clipboard, i.e. can be pastes again - easy word swaps).

Locations you should know: ~/.vimrc

Initially, do this:

rvm @webshop3 do gem list

rvm @global do gem install bundler -v=1.8.2

# add a method that allows an object to add dyn. new instance methods.
module A
klass.instance_eval do
send(:attr_accessor, :observers)
instance_variable_set("@#{:observers}", [])
end
end
# including this object prepends a class' initializer
module B