Skip to content

Instantly share code, notes, and snippets.

View pkulev's full-sized avatar

Pavel Kulyov pkulev

View GitHub Profile
(defpackage :dat-application
(:use :cl)
(:export #:application))
(in-package :dat-application)
(defvar *application*)
(defclass application ()
((data :initform 0)))
@pkulev
pkulev / pkg
Created May 30, 2019 14:59
Yasnippet for creating elisp package. Place it to ~/.emacs.d/snippets/emacs-lisp-mode/pkg. `user-full-name` and `user-mail-address` should be defined.
# -*- mode: snippet -*-
# name: Generate elisp package
# key: pkg
# --
;;; ${1:package-name}.el --- ${2:Description}.
;; Copyright (C) `(sixth (decode-time (current-time)))` `(user-full-name)`
;; Author: `(user-full-name)` <`user-mail-address`>
;; Maintainer: `(user-full-name)` <`user-mail-address`>
@pkulev
pkulev / _reader-macros.md
Created April 25, 2018 13:27 — forked from chaitanyagupta/_reader-macros.md
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@pkulev
pkulev / o-notation.md
Last active April 2, 2018 16:48
Efficiency and Orders of Growth

Efficiency and Orders of Growth

Measuring complexity:

  • time
  • memory

Mesuring base steps

  • use a random access machine as model of computation
  • steps are executed sequentially
#include <map>
#include <iostream>
using namespace std;
class NetworkInterface {
public:
int a = 5;
@pkulev
pkulev / GravityJump.cs
Created January 15, 2018 05:55
Not physically ideal but good jump
using UnityEngine;
using System.Collections;
public class GravityJump : MonoBehaviour {
public float fallMultiplier = 2.5f;
public float lowJumpMultiplier = 2f;
Rigidbody2D rb;
import argparse
import socket
import logging
import threading
LOG = logging.getLogger(__name__)
"""Logger instance."""
DEBUG = False
# -*- coding: utf-8 -*-
T_TRIGGER_ACTION_MANUAL = "manual action"
T_TRIGGER_ACTION_SINGLE = "single action"
T_TRIGGER_ACTION_DOUBLE = "double action"
T_AMMO_9x18gzh = "9x18gzh"
T_AMMO_9x19para = "9x19para"
T_AMMO_45ACP = ".45ACP"
//---------------------------------------------------------------------------
#pragma hdrstop
#include <tchar.h>
#include <iostream>
#include <conio.h>
#include <stdlib.h>
//---------------------------------------------------------------------------
typedef short unsigned int SUINT;
@pkulev
pkulev / db.py
Created November 15, 2016 16:50
""" """
# Tuple functions
def append(tup, elem): return tup + (elem,)
def ainit(length, func):
return reduce(append, map(func, range(length)), ())