Skip to content

Instantly share code, notes, and snippets.

@oxitnik
oxitnik / gist:1478994
Created December 14, 2011 23:03
visual studio gitignore
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
@oxitnik
oxitnik / lisp_lab.lisp
Created March 26, 2012 19:32
fucking lisp lab
;1
(defun calc-poly (x)
(+ (* (- (* (+ (* (- (* 2 x) 3) x) 4) x) 5 ) x) 6))
;2
(defun NULL1 (a)
(if a nil T))
(defun CADDR1 (lst)
(car (cdr (cdr lst))))
@oxitnik
oxitnik / gist:2335708
Created April 8, 2012 07:38
lisp lab 3
;1
(defun fib-r (n)
(cond
( (eql n 1) 1)
( (eql n 2) 2)
(t (+ (fib-r (- n 1)) (fib-r (- n 2))))
)
)
(defun fib-i (n)
;1
(defun factorial (n)
(if (equal n 1) 1 (* n (factorial(- n 1))))
)
(defun map-factorial (lst)
(mapcar 'factorial lst)
)
;2
(defun map-sum (l1 l2)
(defconstant color-names '("Red" "Green" "Orange" "Yellow" "Purple" "Tan" "Black" "White" "Brown" "Grey" ))
(defconstant color-letters "0123456789")
(defconstant max-colors 10)
(defconstant max-positions 8)
(defconstant max-rounds 10)
(defconstant max-moves 20)
(defun make-permutation (positions colors)
(let ((color-string (make-array positions :element-type 'character)))
@oxitnik
oxitnik / gpss_helpers.py
Created June 7, 2012 14:26
code generators for gpss for network sim
#test
f = open("out.gpss.pp.txt","w+")
mode = "RENUM" #"GEN_SWQ" #"GEN_SW_CHAN"
if mode == "GEN_SW_CHAN":
sws = [ (10, 11), (10,12), (10,13), (10,14), (14,15), (14,16), \
(20,21), (20,22), (20,23), (20,24), (10,20)]
for inp,out in sws:
f.write("7400 aS{0}S{1} SEIZE kS{0}S{1}\n".format(inp, out))
f.write("7410 ADVANCE ADV_k\n")
f.write("7420 RELEASE kS{0}S{1}\n".format(inp, out))
@oxitnik
oxitnik / chistlist.cpp
Created June 8, 2012 09:10
Simple List Implementation C++
#include <iostream>
using namespace std;
class List
{
private:
struct ListItem
//структура для хранения списка
{
int value; // заначение
@oxitnik
oxitnik / find_zyxel_nas.py
Created September 3, 2012 16:49
Script for searching Zyxel NAS.
import socket
host = ''
port = 50127
data = '\x00\x42\x02\x01\x40\x61\x86\xff\xbb\x97\x00\x14\xa9\xfe\x54\xb5\xff\xff\x00\x00'
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.bind((host, port))