Skip to content

Instantly share code, notes, and snippets.

View z3t0's full-sized avatar

Rafi Khan z3t0

View GitHub Profile
// trying to convert an arraylist T to an array of T
// this works
List<String> list = new ArrayList<>();
String[] a = list.toArray(new String[0]);
// why doesn't this?
arr = unsorted.toArray(new T[0]);
@z3t0
z3t0 / data.json
Created May 30, 2018 14:13
converting hex bytes to json struct
{"source_address": 1,
"destination_address": 0,
"payload_type": 0,
"length": 0,
"crc_present": 0,
"payload": {"mission_time": 0,
"state": 0,
"flag_ematch_1_present": 0,
"flag_ematch_2_present": 0,
"flag_parachute_deployed": 0,
def create_linear_stock(value=None):
if not value:
value = random.randint(1, 100)
stock = dict(locals())
stock['symbol'] = uuid4()
stock['slope'] = random.uniform(-1, 1)
@z3t0
z3t0 / notes.org
Created April 30, 2018 02:36
research on database

SQL vs NOSQL

  • SQL: relational, NOSQL: non relational
  • SQL: universal but defined schema
  • NoSQL: unstructured dynamic schema
  • SQL is vertically scalable, increased resources of one machine
  • NoSQL is horizontally scalable, increase number of machines
  • NoSQL can become larger and more powerful
  • NoSQL does not require a DBA (Database Administrator)
    • flexible and high performing
@z3t0
z3t0 / asd
Created April 29, 2018 23:35
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDJ4zjIUueE0QNGhFCA77+ODznANyIOtiTlPsLDMpbnTLi5xHFHb/OP9w8wyD32eB83qbzpfow1Kh0MArPb5qCnBl2ziCyzIW33pdzwngJSlVGZmS/Svn8WEMnrRmddxfzRR9F89fQ/+Sx6eQKk3bmpq/r9A9ukgp20Kl3uIWj4RLnVkuyb8fwKGD+3m2UlOxgmiV8HP03Kev9vzv/ZzioRi2zVZv7QmbfhWOFB08L4PWTtqSzkR3pQyDGngorcm95+fWnAAD9rZaA71wTU5Rv9WL7jJ7a0qJ62EHpD0Z+m4guhLjoZ7W3eqcad7n//OxrJ5He3RWdy1zgne7fa9lRN2HI1J8JHCVcNan1NXHNtK012tvomeYce0cIcRPLNILHOAadsBYue1ML8Gaia/fGdx8A/SuUTDg5974lH7B9C54XD4F4u9yURGLK/ls7azMSrKe5c3RfqMZytQXXYKihTxIPWjWpXqOTe71yfp3C1tHLttgeU2C2wEmV0/H0EbjqXdkdzQMPTnvMbrW3y0WwCCB9QGJ9w4QBBGATO0Jwz4IFZLE2FJqh6ZxNfkBNzukpye4L9nYRIEyc2RJwuv9eEsCeBQcCsd6D2+Pk9tYJJqDWFIMiQI1rK9/SFrwQy4BfDS1GoeeQHQOzRuzHrfRR4+sF+c6M5urdjD99cJi2cXQ== zetoslab@gmail.com
➜ IRremote-SIL git:(master) make version
make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
g++ --version
Warning: Opening nnimap server on gmail...failed: ; Unable to open server nnimap+gmail due to: make client process failed: Connection refused, :name, *nnimap*, :buffer, *nnimap localhost nil *nntpd**, :host, localhost, :service, imap; Opening nntp server on news...failed: >>> (file-error make client process failed Network is unreachable :name nntpd :buffer *server news nntp *nntpd** :host news :service nntp); Server nntp+news previously determined to be down; not retrying; Opening nntp server on news...failed: >>> (file-error make client process failed Network is unreachable :name nntpd :buffer *server news nntp *nntpd** :host news :service nntp); Server nntp+news previously determined to be down; not retrying
(defparameter *test-db* nil)
(push (list :name "Bob") *test-db*)
(print *test-db*)
;; ((:NAME "Bob"))
(getf (first *test-db*) :bots)
;; returns nil (as expected)
(setf (getf (first *test-db*) :bots) '(1))
;; returns (1) (as expected)
((:TITLE "Thunder" :ARTIST "Imagine Dragons" :RATING 8 :RIPPED NIL) (:TITLE "Kissing Strangers" :ARTIST " DNCE" :RATING 3 :RIPPED NIL) (:TITLE "You're Such A" :ARTIST "Hailee Steinfeld" :RATING 7 :RIPPED NIL) (:TITLE "Believer" :ARTIST "Imagine Dragons" :RATING 8 :RIPPED NIL) (:TITLE "Speed of Sound" :ARTIST "Cold Play" :RATING 8 :RIPPED NIL) (:TITLE "Demons" :ARTIST "Imagine Dragons" :RATING 10 :RIPPED NIL))
@z3t0
z3t0 / cd.lisp
Last active July 24, 2017 07:59
(defun make-cd (title artist rating ripped) (list :title title :artist artist :rating rating :ripped ripped))
(defvar *db* nil)
(defun add-record (cd) (push cd *db*))
(defun dump-db () (format t "~{~{~a~10t~a~%~}~%~}" *db*))
(defun prompt-read (prompt)
(format *query-io* "~a: " prompt)