Skip to content

Instantly share code, notes, and snippets.

View danielkraic's full-sized avatar

Daniel Kraic danielkraic

View GitHub Profile
package main
import (
"fmt"
"strings"
)
type Country struct {
Code string
Name string

docker

docker version
docker info

run

<!-- widget 1 -->
<a href="https://www.mkck.sk/nase-akcie-v-cechach/">
<img src="https://www.mkck.sk/wp-content/uploads/2018/01/Budko.jpg"
class="image wp-image-9540 attachment-full size-full"
alt=""
style="max-width: 100%; height: auto;"
width="266"
height="201">
</a>
p, .entry-content, .gallery-caption {
font-size: 14px;
}
.entry-content, .entry-summary {
padding: 0 5% 5%;
}
.site {
max-width: 1600px;
@danielkraic
danielkraic / bits.cpp
Created December 12, 2017 16:23
bits operartions
short val = 12;
// check if bit is set:
if (val & 0b0010) return true;
// ensure bit is 1:
val = val | 0b0010;
// ensure bit is o:
val = val & ~0b0010;
@danielkraic
danielkraic / deprecated_route.py
Created June 6, 2017 20:04
flask deprecated_route
# deprecated_route.py
registered_deprecated_routes = set()
register_deprecated_routes = True
def is_deprecated(route):
return route in registered_deprecated_routes
@danielkraic
danielkraic / frequency.erl
Last active April 10, 2017 05:06
solution to 'Enhancing the frequency server' - week 1 assignment of futurelearn's Concurrent programming Erlang
%% Based on code from
%% Erlang Programming
%% Francecso Cesarini and Simon Thompson
%% O'Reilly, 2008
%% http://oreilly.com/catalog/9780596518189/
%% http://www.erlangprogramming.org/
%% (c) Francesco Cesarini and Simon Thompson
-module(frequency).
-export([start/0,allocate/0,deallocate/1,stop/0,clear/0]).
db.data.drop()
db.data.insertOne({"name": "val1"})
db.data.insertOne({"_id": "id100", "name": "val1"})
db.data.insertMany([
{ "name": "val1" },
{ "name": "val2" }
]
)

bash

filename metacharacters

  • * any string
  • ? any single character
  • [abc..] match one of enclosed characters
  • [!abc..] match any characters not enclosed
  • ~ home dir
  • ~user user home dir
#include <iostream>
#include <memory>
#include <mutex>
// ScopedResource: resource with mutex (acquire resource in constructor, release in destructor)
template <class T>
class ScopedResource {
public:
ScopedResource(std::pair<T*, std::mutex&> resource)
: d_resource(resource.first),