Skip to content

Instantly share code, notes, and snippets.

Avatar

Rafi Khan z3t0

View GitHub Profile
View array.java
// 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
converting hex bytes to json struct
View data.json
{"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,
View gist:1e3870f88e246276f0e5ae3f417dcd08
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 Apr 30, 2018
research on database
View notes.org

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
View asd
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDJ4zjIUueE0QNGhFCA77+ODznANyIOtiTlPsLDMpbnTLi5xHFHb/OP9w8wyD32eB83qbzpfow1Kh0MArPb5qCnBl2ziCyzIW33pdzwngJSlVGZmS/Svn8WEMnrRmddxfzRR9F89fQ/+Sx6eQKk3bmpq/r9A9ukgp20Kl3uIWj4RLnVkuyb8fwKGD+3m2UlOxgmiV8HP03Kev9vzv/ZzioRi2zVZv7QmbfhWOFB08L4PWTtqSzkR3pQyDGngorcm95+fWnAAD9rZaA71wTU5Rv9WL7jJ7a0qJ62EHpD0Z+m4guhLjoZ7W3eqcad7n//OxrJ5He3RWdy1zgne7fa9lRN2HI1J8JHCVcNan1NXHNtK012tvomeYce0cIcRPLNILHOAadsBYue1ML8Gaia/fGdx8A/SuUTDg5974lH7B9C54XD4F4u9yURGLK/ls7azMSrKe5c3RfqMZytQXXYKihTxIPWjWpXqOTe71yfp3C1tHLttgeU2C2wEmV0/H0EbjqXdkdzQMPTnvMbrW3y0WwCCB9QGJ9w4QBBGATO0Jwz4IFZLE2FJqh6ZxNfkBNzukpye4L9nYRIEyc2RJwuv9eEsCeBQcCsd6D2+Pk9tYJJqDWFIMiQI1rK9/SFrwQy4BfDS1GoeeQHQOzRuzHrfRR4+sF+c6M5urdjD99cJi2cXQ== zetoslab@gmail.com
View output
➜ 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
View error
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
View snippet.lisp
(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)
View cd.db
((: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))
View cd.lisp
(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)