Skip to content

Instantly share code, notes, and snippets.

View cleac's full-sized avatar

@alexcleac cleac

View GitHub Profile
@cleac
cleac / merge-sort.lisp
Created May 30, 2017 06:44
Merge sort implementation in lisp
(defun merge-sort(lst)
(defun merge_(f s)
(cond
((= (list-length f) 0) s)
((= (list-length s) 0) f)
((< (car f) (car s)) (append (list (car f)) (merge_ (cdr f) s)))
((> (car f) (car s)) (append (list (car s)) (merge_ f (cdr s))))
((= (car f) (car s)) (append (list (car f) (car s)) (merge_ (cdr f) (cdr s))))
)
)
@cleac
cleac / range.lisp
Created May 30, 2017 06:42
Python style range implementation in lisp
(defun range(s &optional end step_)
(let
(
(start (cond
(end s)
(T 0)))
(end (cond
(end end)
(T s)))
(step_ (cond
@cleac
cleac / functional-factorial.lisp
Last active May 29, 2017 21:32
A factorial implementation in lisp
; More functional approach, but it gets a stack overflowed on huge numbers
(defun factorial(num)
(cond
((< num 1) 1)
(t (* (factorial (- num 1)) num))
)
)
@cleac
cleac / vagga.yaml
Created October 7, 2016 20:53
Example of Vagga.yaml with MongoDB
containers:
ubuntu:
setup:
- !Ubuntu trusty
- !UbuntuUniverse
mongodb:
setup:
- !Container ubuntu
- !AptTrust keys: [EA312927]
# Rebind C-b to C-a
unbind C-b
set-option -g prefix `
bind ` send-prefix
bind M-r source-file ~/.tmux.conf
# Fast pane switching
bind -n M-h select-pane -L
bind -n M-l select-pane -R
@cleac
cleac / plugins.txt
Created April 13, 2016 11:44
Sublime text plugins I use
[
"AdvancedNewFile",
"All Autocomplete",
"Better CoffeeScript",
"Bracketeer",
"BracketHighlighter",
"C++11",
"Darkula Color Scheme",
"DocBlockr",
"DocBlockr_Python",
@cleac
cleac / js_generators.js
Created March 6, 2016 20:21
The python's generator implementation for javascript. Just for fun
'use strict';
function IntGenerator(start, end, step) {
this.start = start || 0;
this.current = start || 0;
this.end = end || this.current;
this.step = step || ((this.current > this.end) ? -1 : 1);
}
IntGenerator.prototype[Symbol.iterator] = function () {
@cleac
cleac / login_mdl.html
Last active January 28, 2016 23:22
The test login page
<!DOCTYPE html>
<html>
<head>
<title>Test login page</title>
<link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css">
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">
<style type="text/css">
public class BluetoothService extends Service {
private final static String LOG_TAG = BluetoothService.class.getName();
private final static String AUTHORITY = "com.forcemove.forceemotion.bt";
private final int SERVICE_STATUS_ID = 1;
private BluetoothGatt mBluetoothGatt;
public final static String ACTION_GATT_CONNECTED = AUTHORITY + ".ACTION_GATT_CONNECTED";
public final static String ACTION_GATT_CONNECTING = AUTHORITY + ".ACTION_GATT_CONNECTING";