Skip to content

Instantly share code, notes, and snippets.

[00:21:46.442,657] <dbg> zmk: split_central_notify_func: [NOTIFICATION] data 0x20011c75 length 16
[00:21:46.442,687] <dbg> zmk: split_central_notify_func: data: 0
[00:21:46.442,687] <dbg> zmk: split_central_notify_func: data: 8
[00:21:46.442,718] <dbg> zmk: split_central_notify_func: data: 0
[00:21:46.442,718] <dbg> zmk: split_central_notify_func: data: 0
[00:21:46.442,718] <dbg> zmk: split_central_notify_func: data: 0
[00:21:46.442,749] <dbg> zmk: split_central_notify_func: data: 0
[00:21:46.442,749] <dbg> zmk: split_central_notify_func: data: 0
[00:21:46.442,779] <dbg> zmk: split_central_notify_func: data: 0
[00:21:46.442,779] <dbg> zmk: split_central_notify_func: data: 0
@leira
leira / clj.strace
Created January 21, 2020 22:47
`$HOME/?/.m2` folder is created when running clj installed by Nix within gLinux
execve("/nix/store/as6s9l5vnjv9abl3bhmjljqd6zdjglwk-clojure-1.10.1.469/bin/clj", ["clj", "-e", "(println \"Hello!\")"], 0x7ffe4347bad0 /* 125 vars */) = 0
brk(NULL) = 0x1236000
access("/etc/ld-nix.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/hnp72ygssavd526rp7qk3yjylyc2klcw-glibc-2.27/lib/tls/haswell/avx512_1/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/hnp72ygssavd526rp7qk3yjylyc2klcw-glibc-2.27/lib/tls/haswell/avx512_1/x86_64", 0x7ffff1f13430) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/hnp72ygssavd526rp7qk3yjylyc2klcw-glibc-2.27/lib/tls/haswell/avx512_1/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/hnp72ygssavd526rp7qk3yjylyc2klcw-glibc-2.27/lib/tls/haswell/avx512_1", 0x7ffff1f13430) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/hnp72ygssavd526rp7qk3yjylyc2klcw-glibc-2.27/lib/tls/haswell/x86_
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"
using ll = long long;
bool isPrime(ll n)
{
if (n == 1) return false;
auto ub = std::sqrt(n);
for (int i = 2; i <= ub; i += 1) {
@leira
leira / split_join.cpp
Created September 24, 2018 08:03
C++ string split and join
#include <string>
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"
std::vector<std::string> split(std::string const& str, std::string const& delim)
{
std::vector<std::string> tokens;
std::string::size_type s = 0;
@leira
leira / hamming.clj
Last active December 21, 2017 20:48
Codewars Hamming Numbers https://www.codewars.com/kata/hamming-numbers/train/clojure. A demo of sort-merge and recursive lazy seqs
(defn sort-merge [colls]
(if (<= (count colls) 1)
(first colls)
(let [mi (apply min (map first colls))]
(cons mi
(lazy-seq
(->> (map (fn [[f & r :as coll]]
(if (= f mi) r coll))
colls)
(filter some?)
@leira
leira / selections.clj
Created August 18, 2017 10:04
Generate all the len length sequences with elements from xs #clojure
(defn selections [xs len]
(if (zero? len)
[[]]
(mapcat (fn [pd] (map #(conj pd %) xs))
(selections xs (dec len)))))
(defn selections-with-all [xs len]
(filter #(= (set %) (set xs)) (permu xs len)))
@leira
leira / 0_reuse_code.js
Created August 18, 2017 08:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@leira
leira / cVimrc
Last active December 21, 2016 06:06
cVim Settings
map u scrollFullPageUp
let blacklists = ["https://mail.google.com/*","https://www.google.com/maps/*","https://www.codingame.com/*","http://localhost/*"]
" Site Specific settings
site '*://feedly.com/*' {
unmap ?
unmap gg
unmap G
unmap j
unmap k
unmap J
@leira
leira / _README.md
Created November 8, 2015 10:03 — forked from naholyr/_README.md
Chrome extension exposing JS API

Install

Clone the repo and drop the folder into "chrome://extensions" page.

Use

Open any web page ("about:blank" will work too) and a console, then inspect and play with MY_API global variable.

@leira
leira / 1 README.md
Created November 8, 2015 05:30 — forked from KBalderson/1 README.md
Use DevDocs.io as the documentation URL for investigate.vim

Steps

  1. Install investigate.vim
  2. Append the contents of the included .vimrc to your own .vimrc file
  3. Profit!