Skip to content

Instantly share code, notes, and snippets.

View tzach's full-sized avatar

Tzach Livyatan tzach

View GitHub Profile
@tzach
tzach / create-github-issue.el
Created June 14, 2016 10:15
replace an issue number with a markdown link to github issue
(setq github-project-prefix "https://github.com/scylladb/scylla/issues/")
(defun create-github-issue (string &optional from to)
"replace a #xxx with [#xxx](https://github.com/scylladb/scylla/issues/xxx)"
(interactive
(if (use-region-p)
(list nil (region-beginning) (region-end))
(let ((bds (bounds-of-thing-at-point 'paragraph)) )
(list nil (car bds) (cdr bds)) ) ) )
(let (workOnStringP inputStr outputStr)
/***************************/
/* simple root car */
/***************************/
// engine part from
// http://www.instructables.com/id/Control-DC-and-stepper-motors-with-L298N-Dual-Moto/?ALLSTEPS
// sndor part from
// http://www.instructables.com/id/Simple-Arduino-and-HC-SR04-Example/?ALLSTEPS
/*
## Presto
$ cd etc
etc$ ls -la
total 28
drwxrwxr-x 3 tzach tzach 4096 Jun 27 10:24 .
drwxr-xr-x 8 tzach tzach 4096 Jun 27 10:24 ..
drwxrwxr-x 2 tzach tzach 4096 Jun 27 10:19 catalog
-rw-rw-r-- 1 tzach tzach 203 Jun 27 10:19 config.properties
-rw-rw-r-- 1 tzach tzach 176 Jun 27 10:18 jvm.config
@tzach
tzach / provision-ec2-volume.yaml
Created July 19, 2016 20:49
Ansible playbook to start a Scylla cluster, with 10 EBS attached to each node
## This Ansible script start a cluster of 3 nodes on EC2
## And attach 10 ESB, 100G each
- name: Provision voulums
hosts: localhost
connection: local
vars:
region: us-east-1
cluster_nodes: 3
user_data: "--clustername test-cluster --totalnodes {{cluster_nodes}}"
@tzach
tzach / scyllatop-to-list.sh
Created July 21, 2016 08:24
Extract a sorted list of metrics from scyllatop
cat scylla.1.2.1.metrics.txt | sed 's/.$//' | sed 's/^.//' | cut -d"/" -f2- | sed 's/.$//' | sort
cqlsh>
CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
use mykeyspace ;
CREATE TABLE users (user_id int PRIMARY KEY, fname text, lname text);
insert into users (user_id , fname, lname) values (1, 'tzach', 'livyatan');
insert into users (user_id , fname, lname) values (2, 'dor', 'laor');
insert into users (user_id , fname, lname) values (3, 'shlomi', 'laor');
insert into users (user_id , fname, lname) values (4, 'shlomi', 'livne');
insert into users (user_id , fname, lname) values (6, 'avi', 'kivity');
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(erc-nick "tzach")
'(package-selected-packages
(quote
(magithub magit helm cider emacsql-mysql twittering-mode ## yaml-mode starter-kit-ruby starter-kit-js starter-kit-eshell starter-kit-bindings scss-mode scala-mode markdown-preview-mode markdown-preview-eww less-css-mode langtool json-mode json js2-mode es-windows emstar clojure-project-mode)))
'(show-paren-mode t))
/***************************/
/* simple robot car */
/***************************/
// engine part from
// http://www.instructables.com/id/Control-DC-and-stepper-motors-with-L298N-Dual-Moto/?ALLSTEPS
// sndor part from
// http://www.instructables.com/id/Simple-Arduino-and-HC-SR04-Example/?ALLSTEPS
/*
@tzach
tzach / live.clj
Last active February 7, 2017 02:20
example of ring, compojure and hiccup
(use 'ring.util.response
'ring.adapter.jetty)
;;;;; handler
(defn hello-handler [req]
(->
(response "Hello")
(content-type "text/html")))
#########
This is a step by step instruction for running a cluster of 3 Scylla nodes and a Scylla monitoring servers, all as Docker images on the same box.
#########
# prerequisites (centos 7)
sudo yum install tmux emacs git wget -y
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository