Skip to content

Instantly share code, notes, and snippets.

View edujtm's full-sized avatar
🐢
Studying

Eduardo José Tomé de Macedo edujtm

🐢
Studying
View GitHub Profile
@dergachev
dergachev / README.md
Created October 10, 2012 16:49
Vagrant tutorial

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

@staltz
staltz / introrx.md
Last active July 27, 2024 04:59
The introduction to Reactive Programming you've been missing
@tknerr
tknerr / README.md
Last active January 23, 2024 16:42
Vagrant with Ansible Provisioner on Windows

Vagrant with Ansible Provisioner on Windows

Long story short, ansible does not work on a Windows control machine, so you basically have to:

  • either run ansible --connection=local ... in the target vm
  • set up a separate control vm where ansible is installed via shell provisioner

Below are Vagrantfile examples for both approaches

Within the Target VM

@jaceklaskowski
jaceklaskowski / deployment-tool-ansible-puppet-chef-salt.md
Last active January 3, 2024 22:12
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@btroncone
btroncone / bootstrap.ts
Last active May 10, 2021 20:53
Basic demonstration of how NgRx middleware can be used to keep local storage in sync with user-defined state slices.
//specify what state slices you would like to keep synced with local storage
export function main() {
return bootstrap(TodoApp, [
provideStore(APP_REDUCERS),
localStorageMiddleware('todos', 'visibilityFilter')
])
.catch(err => console.error(err));
}
@ckimrie
ckimrie / example.component.ts
Last active December 12, 2023 20:53
Example on how to achieve RxJS observable caching and storage in Angular 2+. Ideal for storing Http requests client side for offline usage.
import { Component, OnInit, OnDestroy } from '@angular/core';
import {Http} from "@angular/http";
import { LocalCacheService } from "./local-cache.service";
@Component({
selector: 'app-example',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class ExampleComponent implements OnInit, OnDestroy {
@santrancisco
santrancisco / VagrantFile
Created March 19, 2018 00:55
VagrantFile for official base image - windows 10 with Microsoft edge
# -*- mode: ruby -*-
# vi: set ft=ruby :
## Thanks to the discussion of various developers in this gist
## https://gist.github.com/andreptb/57e388df5e881937e62a#gistcomment-2346821
## Especially clement-igonet.
### How to get Windows10 with Edge official base image run with WinRM and RDP:
# To use Windows10-Edge vagrant you will first need to download https://aka.ms/msedge.win10.vagrant (this is now a zip file)
# Execute `vagrant box add ./MsEdge\ -\ Win10.box --name Win10-official` after unzip the file to add the box to our base image list
@JoseAlcerreca
JoseAlcerreca / EventObserver.kt
Created April 26, 2018 12:14
An Observer for Events, simplifying the pattern of checking if the Event's content has already been handled.
/**
* An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has
* already been handled.
*
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled.
*/
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> {
override fun onChanged(event: Event<T>?) {
event?.getContentIfNotHandled()?.let { value ->
onEventUnhandledContent(value)
@felix19350
felix19350 / ktor-full-example.kt
Last active July 15, 2023 12:42
Barebones Ktor REST API example
package org.example
import com.zaxxer.hikari.HikariConfig
import com.zaxxer.hikari.HikariDataSource
import io.ktor.application.call
import io.ktor.http.HttpStatusCode
import io.ktor.request.receive
import io.ktor.response.respond
import io.ktor.routing.Route
import io.ktor.routing.get
@Viska97
Viska97 / TestBoundaryCallback.kt
Last active March 7, 2019 17:42
PagedList.BoundaryCallback with coroutines
class TestBoundaryCallback(
private val pageSize: Int,
private val dataSource: BackendDataSource,
private val database : AppDatabase
) : PagedList.BoundaryCallback<?>(){
var networkState = MutableLiveData<Int>()
private var isRequestInProgress = false