Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Harris Brakmić brakmic

🏠
Working from home
View GitHub Profile
View generators_inCode_tutorial.js
//helper function for DOM manipulation
var updateDOM = function(res,res2,res3){
$('#res').html(JSON.stringify(res));
$('#res2').html(JSON.stringify(res2));
$('#res3').html(JSON.stringify(res3));
};
//Defines a generator to call a JSON webservice.
//info 1: for each "yield" a separate generator call is needed
//this is why generators are called "pausable functions"
View twitter_client.py
# THIS CODE IS NOW RETIRED. GO TO THE NEW REPOSITORY: https://github.com/brakmic/TwitterClient
# -*- coding: utf-8 -*-
#==============================================================================
# A simple console-based twitter client capable of persisting data
# Usage: python client.py --config=your_json_config.json
# To persist to a database a valid DNS entry is needed.
# Also, create a proper Tweets table. Check 'insert' method in DbConnector.
# =============================================================================
View keybase.md

Keybase proof

I hereby claim:

  • I am brakmic on github.
  • I am brakmic (https://keybase.io/brakmic) on keybase.
  • I have a public key whose fingerprint is F7CF 8C4A 79D8 9EBE 0808 74C3 F8B1 3389 9C9B 8056

To claim this, I am signing this object:

@brakmic
brakmic / git_workflow.md
Last active Dec 22, 2016
A simple git workflow demonstration under Windows
View git_workflow.md

Preparation

  • Download Git from here: https://git-for-windows.github.io/

  • Click Next, Next, blah, blah...until you get a proper Git environment in your Windows box

  • Open Git Shell, or any other command prompt that has access to your Git path (if unsure, check System Environment Settings)

Initialize Repository

View thrill_kmeans_includes.cpp
#include <thrill/api/cache.hpp>
#include <thrill/api/generate.hpp>
#include <thrill/api/print.hpp>
#include <ostream>
#include <random>
using thrill::DIA;
View thrill_kmeans_main.cpp
int main() {
// launch Thrill program: the lambda function will be run on each worker.
return thrill::Run(
[&](thrill::Context& ctx) { Process(ctx); });
}
View thrill_kmeans_process.cpp
void Process(thrill::Context& ctx) {
std::default_random_engine rng(std::random_device { } ());
std::uniform_real_distribution<double> dist(0.0, 1000.0);
// generate 100 random points using uniform distribution
DIA<Point> points =
Generate(
ctx, /* size */ 100,
[&](const size_t& /* index */) {
return Point { dist(rng), dist(rng) };
})
@brakmic
brakmic / main_script.ts
Created Mar 12, 2017
webvr - project - main script
View main_script.ts
export function main(): Promise<any> {
return platformBrowserDynamic()
.bootstrapModule(AppModule)
.then(decorateModuleRef)
.catch((err) => console.error(err));
}
View hello_webvr_module.ts
const hello = <IVrModule>{
id: '001',
name: 'hello',
type: VrModuleType.AFrame,
markup: `
<a-scene>
<a-sphere position="0 1.25 -1" radius="1.25" color="#EF2D5E"></a-sphere>
<a-box position="-1 0.5 1" rotation="0 45 0" width="1" height="1" depth="1"
color="#4CC3D9"></a-box>
<a-cylinder position="1 0.75 1" radius="0.5" height="1.5" color="#FFC65D">
@brakmic
brakmic / vr-module-register.ts
Created Mar 12, 2017
registering vr modules and dispatching messages
View vr-module-register.ts
public registerModule(): Observable<IServiceMessage> {
return this.asObservable().map((mod) => {
if (!_.isNil(mod) &&
!_.isNil(mod.id) &&
!_.isNil(mod.name)) {
this.store.dispatch( { type: VR_MODULE_ADDED, payload: mod });
return <IServiceMessage> {
id: '0000',
content: `Registered vr module '${mod.name}'`
};