Skip to content

Instantly share code, notes, and snippets.

View psyomn's full-sized avatar
♥️
HARD WORK AND DISCIPLINE

psyomn

♥️
HARD WORK AND DISCIPLINE
  • Montreal
View GitHub Profile
@psyomn
psyomn / defmethod.lisp
Last active December 29, 2015 05:19
defmethod without classes
#!/usr/bin/sbcl --script
;;
;; You don't really need to supply a class literal to use methods,
;; this way you can exploid the :before, :after, :around auxiliary
;; methods!
;;
(defmethod myfunc (lst)
(format t "~A~%" lst))
@psyomn
psyomn / testy.erl
Created November 13, 2013 18:27
Erlang printing stuff
Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V5.10.3 (abort with ^G)
1> io:format("Get out of here stalker~n").
Get out of here stalker
ok
.> io:format("Get out of here stalker~p~n",[[1,2,3,4,5]]).
Get out of here stalker[1,2,3,4,5]
ok
3> q().
@psyomn
psyomn / make.rb
Created November 3, 2013 04:37
A _very_ naive makefile implementation that suits my purposes.
#!/usr/bin/env ruby
# @author Simon (psyomn) Symeonidis
# Because doing something this simple in a Makefile requires you to read a huge
# fucking manual.
def make(note, output_name)
puts "#{note} >>> #{output_name}"
`pandoc #{note} -o #{output_name}`
end
@psyomn
psyomn / dynm.rb
Last active December 27, 2015 05:39
Evil Eval
class Person
end
person = Person.new
Person.instance_eval "attr_accessor :name"
person.name = "bobby"
puts person.name
person.instance_eval "def greet; puts 'hello ' end"
@psyomn
psyomn / ghclone.sh
Created October 22, 2013 15:22
Quickhand to download things from github if you remember the username of the guy and her repo.
#!/usr/bin/env bash
if [ -z $1 ] || [ -z $2 ]
then
echo "usage: ghclone username reponame";
exit;
fi
git clone https://github.com/$1/$2.git
@psyomn
psyomn / t.asm
Created October 9, 2013 19:28
Weird stuff again
.file "t.c"
.section .rodata
.LC0:
.string "%d\n"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
@psyomn
psyomn / greek.html
Created September 13, 2013 18:22
Silly implementation for a javascriptish Greek keyboard
<html>
<head>
<style type="text/css">
.main{
margin-top:50px;
margin-bottom:100px;
margin-left:auto;
@psyomn
psyomn / example.rctl
Last active December 18, 2015 18:58
rctl for vim
object Human {
attributes {
expirationDate : date;
}
operations {
breathe() : void;
}
}
/* You can comment in C/C++ ways too */
@psyomn
psyomn / 2csub.rb
Last active December 18, 2015 09:38
Collections of solutions on /r/dailyprogrammer. Yeah I somewhat found a reason to use reddit.
#!/usr/bin/env ruby
# Uri :: http://www.reddit.com/r/dailyprogrammer/comments/1g0tw1/
# Author :: Simon Symeonidis
charbuff = []
current_string, result = String.new, String.new
$stdin.gets.chomp!.chars do |c|
charbuff.push c unless charbuff.member? c
if charbuff.size > 2
charbuff = charbuff.drop(1)
@psyomn
psyomn / group_arr.rb
Last active December 17, 2015 17:18
Things I tend to forget in ruby.
#!/usr/bin/env ruby
arr = [
[:a, [1,2,2,2,2,1]],
[:b, [3,3,3,3,3,4,4,4]],
[:c, [8,8,8,8,8,8,8]]]
headers = arr.collect{|el| el[0]}
headers.each do |h|