Skip to content

Instantly share code, notes, and snippets.


Pavel Kulyov pkulev

View GitHub Profile
View boom.lisp
(defpackage :dat-application
(:use :cl)
(:export #:application))
(in-package :dat-application)
(defvar *application*)
(defclass application ()
((data :initform 0)))
pkulev / pkg
Created May 30, 2019
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.
View pkg
# -*- 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 /
Created Apr 25, 2018 — forked from chaitanyagupta/
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on

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. do their work at read-time.

View main.cpp
#include <map>
#include <iostream>
using namespace std;
class NetworkInterface {
int a = 5;
pkulev / GravityJump.cs
Created Jan 15, 2018
Not physically ideal but good jump
View GravityJump.cs
using UnityEngine;
using System.Collections;
public class GravityJump : MonoBehaviour {
public float fallMultiplier = 2.5f;
public float lowJumpMultiplier = 2f;
Rigidbody2D rb;
pkulev /
Last active Apr 2, 2018
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
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"
View pseudogame.cpp
#pragma hdrstop
#include <tchar.h>
#include <iostream>
#include <conio.h>
#include <stdlib.h>
typedef short unsigned int SUINT;
""" """
# Tuple functions
def append(tup, elem): return tup + (elem,)
def ainit(length, func):
return reduce(append, map(func, range(length)), ())