Skip to content

Instantly share code, notes, and snippets.

View michaltakac's full-sized avatar
👨‍🏫
https://keybase.io/michaltakac

Michal Takac michaltakac

👨‍🏫
https://keybase.io/michaltakac
View GitHub Profile
@michaltakac
michaltakac / generate-pdf.js
Last active July 30, 2022 19:33
Generating PDF from website screenshot using Iron Router and Webshot
/**
* Generating PDF from website screenshot.
*
* Using iron:router's server-side route and meteorhacks:npm to load Webshot NPM package.
* Don't forget to add "webshot": "0.16.0" to your packages.json file. Example:
* {
* "webshot": "0.16.0"
* }
* Tried it with bryanmorgan:webshot but it didn't work so sticking to loading NPM package directly.
* Thanks to @nate-strauser (https://github.com/nate-strauser).
@michaltakac
michaltakac / d2q9_bgk_channel_condensed.cpp
Created March 14, 2021 18:00
Condensed D2Q9 BGK Lattice-Boltzmann code written in C++ using ArrayFire
#include <arrayfire.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace af;
int main(int argc, char *argv[]) {
af::info();
const unsigned nx = 1000, ny = 300;
const unsigned total_nodes = nx * ny;
@michaltakac
michaltakac / grid3d.cpp
Last active March 6, 2021 18:20
Representing 3D grid with ArrayFire
#include <arrayfire.h>
#include <math.h>
#include <stdio.h>
using namespace af;
int main(int argc, char *argv[])
{
int nx = 4;
int ny = 3;
@michaltakac
michaltakac / mongodb.js
Created February 10, 2021 11:48
MongoDB connection through mongoose in a Next.js app
import mongoose from "mongoose";
if (!process.env.MONGODB_URI) {
throw new Error("Please define the MONGODB_URI environment variable inside .env.local");
}
/**
* Global is used here to maintain a cached connection across hot reloads
* in development. This prevents connections growing exponentially
* during API Route usage.
@michaltakac
michaltakac / cfd.md
Created November 19, 2020 22:02 — forked from Wumpf/cfd.md
Notes on CFD
@michaltakac
michaltakac / improved-lnd-bitcoind-install.md
Created July 7, 2018 00:14 — forked from bretton/improved-lnd-bitcoind-install.md
updated & improved guide to installing LND, Bitcoind, on Ubuntu 16.04 Server on testnet

2018-03-18: Updating of this guide is taking a backseat to the mainnet version at

Intro

This guide is specific to getting LND and bitcoind running on ubuntu 16.04 LTS for testnet.

It does not address mainnet, or using btcd, or neutrino.

Original installation guide:

Keybase proof

I hereby claim:

  • I am michaltakac on github.
  • I am michaltakac (https://keybase.io/michaltakac) on keybase.
  • I have a public key ASDzhqrolP04w98A9JRjOHOpQuWnqaZIm50UB1-C2mncwQo

To claim this, I am signing this object:

@michaltakac
michaltakac / snippet
Created February 10, 2017 23:26
barthackahton
class componentName extends Component {
constructor(props) {
this.state = {
spotreba: ''
}
}
componentWillMount() {
var self = this;
axios.get(url)
.then(function(response) {
@michaltakac
michaltakac / index.html
Created September 17, 2016 09:57
Loading Cursor in A-Frame
<!-- CURSOR ENTITY -->
<a-entity position="0 1.8 5">
<a-entity
id="camera"
camera
look-controls
rotation="0 0 0"
wasd-controls
>
<!-- MAIN CURSOR -->
@michaltakac
michaltakac / actionTypeBuilder.js
Last active July 27, 2016 15:07 — forked from dbismut/actionTypeBuilder.js
React Redux Meteor middlewares
export function actionTypeBuilder(prefix) {
return {
type: actionType => `${prefix}/${actionType}`,
loading: actionType => `${actionType}/loading`,
ready: actionType => `${actionType}/ready`,
stopped: actionType => `${actionType}/stopped`,
changed: actionType => `${actionType}/changed`,
error: actionType => `${actionType}/error`,
success: actionType => `${actionType}/success`
};