Skip to content

Instantly share code, notes, and snippets.

View georgyangelov's full-sized avatar

Georgy Angelov georgyangelov

View GitHub Profile
@georgyangelov
georgyangelov / gist:5070915
Last active December 14, 2015 10:18
Sublime Text 2 keybindings
[
{"keys": ["alt+["], "command": "prev_view"},
{"keys": ["alt+]"], "command": "next_view"},
{"keys": ["alt+q"], "command": "close_file"},
{
"keys": ["alt+."],
"command": "set_layout",
"args":
@georgyangelov
georgyangelov / visualizer.py
Last active December 16, 2015 20:39
Visualizer for the dragon fractal challenge
import turtle
from solution import dragon_fractal
LINE_LENGTH = 5 # 1
DELAY_MS = 0
REPEAT_TIMES = 11 # 15
def str_to_heading(str_):
@georgyangelov
georgyangelov / gist:5709474
Created June 4, 2013 20:50
PowerShell script to log cpu usage over time
while (1) {
sleep 10
date >> 'tasks.txt'
Get-Process | Sort-Object CPU -desc | Select-Object -first 5 >> 'tasks.txt'
}
@georgyangelov
georgyangelov / shell.c
Last active December 29, 2015 15:19
Simple shell implementation using POSIX system primitives
#include <unistd.h> // For system constants
#include <stdio.h> // For sprintf
#include <string.h> // For strlen and strcmp mainly
#include <stdlib.h> // For exit (the library function) & getenv
#include <stdarg.h> // For the variable arguments function
/* Constants */
#define MAX_LINE_LENGTH 1000
#define MAX_ARG_LENGTH 100
#define MAX_ARGS_COUNT 50
@georgyangelov
georgyangelov / wol.py
Created November 28, 2013 21:42
Sends a Wake-On-Lan magic packet to the specified address.
import socket
import argparse
parser = argparse.ArgumentParser(description="Wake-On-Lan magic packet sender")
parser.add_argument("ip_address", help="IP address or hostname of the destination")
parser.add_argument("mac_address", help="The mac addresss of the target host")
parser.add_argument("-p", "--port", help="Optional port to send to")
arguments = parser.parse_args()
#include <iostream>
using namespace std;
int main()
{
// Константи - брой редове (M) и колони (N) в матрицата
const int M = 4, N = 6;
// Дефиниция на матрица MxN и задаване на стойности
v=0
o=- 7518264307715983377 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS CCJALAcas2qVJgyxxWGmq2zKZNLF0XnQq2Gu
m=audio 39664 RTP/SAVPF 111 103 104 0 8 106 105 13 126
c=IN IP4 192.168.1.117
a=rtcp:1 IN IP4 0.0.0.0
a=candidate:319969617 1 udp 2113937151 192.168.1.117 39664 typ host generation 0
data Bt a = Et | Ct a (Bt a) (Bt a)
instance Show a => Show (Bt a) where
show t = showTree 3 1 t
showTree :: (Show a) => Int -> Int -> Bt a -> String
showTree dx dy Et = ""
showTree dx dy (Ct root Et Et) = show root
showTree dx dy (Ct root left right) = centerRoot ++ "\n" ++ emptyLines dy ++ unlines subtreeLines
@georgyangelov
georgyangelov / cypher_sample.cql
Last active August 29, 2015 14:13
Sample Neo4j/Cypher queries
create
(p1:Person {name: 'Бригадир Цветков', age: 24, gender: 'm'}),
(p2:Person {name: 'Букетка Градинарова', age: 26, gender: 'f'}),
(p3:Person {name: 'Вовеки Веков Иванов', age: 25, gender: 'm'}),
(p4:Person {name: 'Гъдьо Гъдев', age: 22, gender: 'm'}),
(p5:Person {name: 'Дар Донков', age: 27, gender: 'm'}),
(p6:Person {name: 'Кирка Градинарска', age: 29, gender: 'f'}),
(p7:Person {name: 'Кучо Кучев', age: 30, gender: 'm'}),
(p8:Person {name: 'Лимон Генов', age: 50, gender: 'm'}),
(p9:Person {name: 'Марулка Митева', age: 19, gender: 'f'}),
require 'v8'
V8::C::HandleScope() do
template = V8::C::ObjectTemplate.New()
context = V8::C::Context.New(nil, template)
context.Enter
p V8::C::Object.New()
end