Skip to content

Instantly share code, notes, and snippets.

View Ithildir's full-sized avatar

Andrea Di Giorgi Ithildir

View GitHub Profile
@breskeby
breskeby / build.gradle
Last active August 29, 2015 14:05
Extending objects in NamedDomainObjectContainers (GRADLE)
import org.gradle.internal.reflect.Instantiator
class Host {
String name
Host(String name){
this.name = name
}
}
@tracker1
tracker1 / 01-directory-structure.md
Last active July 17, 2024 07:09
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@jamesabruce
jamesabruce / Philips Hue Candle Effect
Created April 4, 2015 07:22
High speed, flickering candle bulb effect for any number of Philips Hue bulbs
set HUB to "192.168.1.216" --change for your bridge IP
set USER to "newdeveloper"
repeat
repeat with bulb from 1 to 2 -- Change if you have more bulbs or want to use a subset
set hue to (random number from 5000 to 12750)
set sat to (random number from 150 to 255)
set bri to (random number from 50 to 255)
set transitiontime to (random number from 1 to 3) -- Increase range for slower transitions
set query to "{\"sat\":" & sat & ",\"hue\":" & hue & ",\"bri\":" & bri & ",\"transitiontime\":" & transitiontime & "}"
set command to "curl --request PUT --data '" & query & "' http://" & HUB & "/api/" & USER & "/lights/" & bulb & "/state/ --connect-timeout 5"
@MikeNGarrett
MikeNGarrett / siege
Last active April 3, 2024 03:49
Siege with JSON POST data
# Changed to use content-type flag instead of header: -H 'Content-Type: application/json'
siege -c50 -t60S --content-type "application/json" 'http://domain.com/path/to/json.php POST {"ids": ["1","2","3"]}'
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.conn.SchemePortResolver;
import org.apache.http.impl.conn.DefaultRoutePlanner;
import org.apache.http.protocol.HttpContext;
import org.slf4j.LoggerFactory;
/**
* ***[recommended]**** Use System default planner like this :
@bmuschko
bmuschko / OfflineMavenRepository.groovy
Created December 4, 2015 04:58
Creating an offline Maven repository with Gradle
package org.gradle.training
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import org.gradle.api.DefaultTask
import org.gradle.util.GFileUtils
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
import org.gradle.maven.MavenModule
@rotty3000
rotty3000 / vcs-repository-litmus-test.md
Last active September 16, 2017 03:58
Litmus Test for VCS Repository Separation

Litmus Test for VCS Repository Separation

How do you or should you break a monolithic repository into smaller pieces?

The question of whether separation should take place and how granular it should be is a debate that happens in very significantly large project I've been involved with to date.

If the goal is to make developers lives easier, then the split must certainly not cause more harm than good. There can't be a hard and fast rule such as "each module should have it's own repository" because the day to day impact of a project maintained by a single individual could be horrendous if the project contains hundreds of modules. On the other hand, a project with thoudsands of developers and thoudsands of modules likely will struggle equaly with such a rule.

Therefore I'm working on a initial litmus test to determine the criteria for breaking a large repository into several smaller repositories.

@ben-axnick
ben-axnick / 2015-11-yadm.md
Created January 22, 2016 00:33
How to manage dotfiles with YADM

Background

Solutions I've tried

  • Git repo directly checked out in home directory

    • Noisy
    • Have to ignore *, everything is a --force
    • Juggling machine variations is a pain
  • Homesick / Homeshick

  • Functional Programming is a model of programming that transform and compose stream of immutable sequences by applying map, filter and reduce. Events are immutable because you can't change history.
  • Reactive Programming is a model of programming focuses on data flow and change propagation.
  • ReactiveX is an API that focuses on asynchronous composition and manipulation of observable streams of data or events by using a combination of the Observer pattern, Iterator pattern, and features of Functional Programming.
  • RxJava is the open-source implementation of ReactiveX in Java.
  • RxJava is a Java VM implementation of ReactiveX (Reactive Extensions): a library for composing asynchronous and event-based programs by using observable sequences.
  • RxAndroid is a lightweight extension to RxJava that providers a Scheduler for Android’s Main Thread, as well as the ability to create a Scheduler that runs on any given Android Handler class.
  • The two main classes are Observable and Subscriber.
  • `O
@Stwissel
Stwissel / AsyncInputStream.java
Last active March 11, 2024 10:21
AsyncInputStream for vert.x - Take 2
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import io.vertx.core.AsyncResult;
import io.vertx.core.Context;
import io.vertx.core.Future;
import io.vertx.core.Handler;