Skip to content

Instantly share code, notes, and snippets.

View cleac's full-sized avatar

@alexcleac cleac

View GitHub Profile
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";
@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">
@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 / 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",
# 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 / 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]
@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 / 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
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from trafaret_validator import TrafaretValidator
>>> import trafaret as t
>>> class T1(TrafaretValidator):
... id = t.Int()
...
>>> x = T1(id=1)
>>> x.test = 1
@cleac
cleac / vagiclean
Created March 29, 2018 12:35
Script for all unused data from your workspace directory
#!/bin/bash
workspace_dir=$HOME/workspace
case "$1" in
activate)
for dr in $(ls "$workspace_dir"); do
cd "$workspace_dir/$dr"
vagga _clean --unused 2&>1 > /dev/null &
done;;