Skip to content

Instantly share code, notes, and snippets.

View sammko's full-sized avatar
🅱️

Samuel Čavoj sammko

🅱️
View GitHub Profile
#!/bin/bash
now=$(date +%s)000
curl -s -H "Content-Type: application/json" -H 'x-api-key:PDh^2-$-M]8(dG8E+Q,FR}zsfz"Q~:N2pp\ykmg9ZEgKVrh42PHS?^sQ6<3;X,?-' https://app.zssk.sk/api/v1/train/delay -d '[{"trainNumber":"'$1'","travelDate":'$now'}]' | jq
#!/bin/bash
branch=$(git rev-parse --abbrev-ref HEAD)
line=$(head -n1 "$1")
if [ -z "$line" ]; then
sed -i "1s,^,$branch: ," "$1"
fi
@sammko
sammko / intersection-test.ipynb
Last active June 12, 2020 11:20
Intersection Test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sammko
sammko / rbq.c
Created July 17, 2018 08:29
Fixed size ring buffer queue in C
#include <stdlib.h>
typedef int rbq_val_t;
struct rbq_t {
rbq_val_t *buffer;
size_t capacity, size;
size_t p;
};
void init_rbq(struct rbq_t *Q, size_t capacity) {
#!/bin/python
import os, random, sys
CMD = 'mpv --really-quiet --vid=no "{}"'
if len(sys.argv) != 3:
print(f"Usage {sys.argv[0]} FILE_A FILE_B")
sys.exit(1)

Projekt 2

created by xhanze10

Workflow

  1. Run the crash utility on core dump - crash vmlinux vmcore
KERNEL: vmlinux
DUMPFILE: vmcore  [PARTIAL DUMP]
  CPUS: 8

Keybase proof

I hereby claim:

  • I am sammko on github.
  • I am samuelc (https://keybase.io/samuelc) on keybase.
  • I have a public key whose fingerprint is 5CC6 046D 1F11 3312 CF99 6854 E1A7 EE6F 87DB E672

To claim this, I am signing this object:

from itertools import product
def lazy_product(*iterables):
iters = [[i.__iter__(), [], False] for i in iterables]
def _p_next(i, il, _):
z = i.__next__()
il.append(z)
return z
s = True
@sammko
sammko / tictactoe-hypercube-lines.py
Created March 6, 2017 20:21
tictactoe-hypercube-lines
lambda n: list(chain.from_iterable(chain.from_iterable(map(list, [chain.from_iterable(map(lambda s: [[[(-1 if i in j else 1)*int(i in s) for i in range(n)] for j in combinations(s[1:],q)] for q in range(len(s))], combinations(range(n),M))) for M in range(1,n+1)]))))
@sammko
sammko / designer.html
Last active August 29, 2015 14:09
designer
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;