Skip to content

Instantly share code, notes, and snippets.

View karlicoss's full-sized avatar
🌴
🐰

karlicoss

🌴
🐰
View GitHub Profile
@karlicoss
karlicoss / test
Created January 14, 2012 10:28
test
int main()
{
return 0;
}
// CS124 HW1 SpamLord
import java.util.regex.*;
import java.util.Collections;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.io.*;
@karlicoss
karlicoss / gist:5c989f0e5321bda7a66a
Created March 19, 2016 18:27
Kotlin immutable list bytecode
Compiled from "test.kt"
public final class TestKt {
public static final void main(java.lang.String[]);
Code:
0: aload_0
1: ldc #9 // String args
3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkParameterIsNotNull:(Ljava/lang/Object;Ljava/lang/String;)V
6: new #17 // class ImmutableList
9: dup
10: iconst_5
@karlicoss
karlicoss / Immutable.kt
Last active March 19, 2016 18:35
Immutable covariant list
import java.util.*
abstract class Stream<out T>() {
abstract fun <R> with(value: R): Stream<Pair<T, R>>;
}
сlass ImmutableList<out T>: Stream<T> {
private val data: ArrayList<T>;
@karlicoss
karlicoss / id_wtf.py
Created April 8, 2016 22:26
Python id() wtf
l = [4, 5, 6]
l2 = [1, 2, 3]
print(id(l))
print(id(l2))
print("--------")
print(id([4, 5, 6]))
print(id([1, 2, 3]))
# Result:
#include <iostream>
#include <sstream>
#include <array>
using namespace std;
enum class State {
FINISHED, UNFINISHED
};
W = 2
a = 0
b = -a
L = 1
def rvar(name):
return var(name, domain='real')
W = var('W', domain='integer')
@karlicoss
karlicoss / inplace_merge_sort.cpp
Created July 12, 2016 00:43
In place merge sort
#include <iostream>
#include <algorithm>
#include <cassert>
#include <iterator>
using namespace std;
template <typename ForwardIterator>
void merge_into(ForwardIterator from, ForwardIterator mid, ForwardIterator to, ForwardIterator buffer) {
@karlicoss
karlicoss / emfitqs-local-api.md
Created August 18, 2018 11:47 — forked from harperreed/emfitqs-local-api.md
EMFIT QS Sleep tracker location API

EMFIT Local API

There is a functional http server running on the device that can be crawled for realtime data. It runs on port 80 and uses plain http.

You will need to know the IP address if your emfit device.

shortdvm.htm

For demoing / testing with a web browser there is an auto-refreshing page that contains only HR and RR values, it’s name is shortdvm.htm

@karlicoss
karlicoss / init.el
Created September 29, 2019 10:28
Snipped for org-mode agenda to show presence of notes
(with-eval-after-load 'org-agenda
(defun my/org-has-children ()
(if (save-excursion (org-goto-first-child)) "▶" " ")
)
(add-to-list 'org-agenda-prefix-format '(
agenda . "%i%-3:(my/org-has-children) %-12:c%?-12t% s "
))
)
; Result: