Skip to content

Instantly share code, notes, and snippets.

View mgraciano's full-sized avatar

Michel Graciano mgraciano

View GitHub Profile
@so0k
so0k / kubectl.md
Last active August 12, 2026 19:59
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@danieldietrich
danieldietrich / ExampleWithJavaslang.java
Last active August 29, 2015 14:26
Pattern Matching for Java
public static void main(final String... args) {
// this is javaslang.collection.Stream
Stream.of(0, 1, 2, 3, 13, 14, null, -1)
.peek(n -> out.print(format("%d -> ", n)))
.map(Match.as(Object.class) // match as function
.when(Objects::isNull).then("!")
.whenIs(0).then(nil())
.when(is(1)).then("one")
.whenIs(13).then(() -> "unlucky")
.whenIs(14).then(printIt())
@staltz
staltz / introrx.md
Last active September 28, 2026 12:28
The introduction to Reactive Programming you've been missing
@jelbourn
jelbourn / api-provider.js
Last active September 20, 2025 17:27
Example of using an angular provider to build an api service. Subject of August 20th 2013 talk at the NYC AngularJS Meetup. http://www.meetup.com/AngularJS-NYC/events/134578452/See in jsbin: http://jsbin.com/iWUlANe/5/editSlides: https://docs.google.com/presentation/d/1RMbddKB7warqbPOlluC7kP0y16kbWqGzcAAP6TYchdw
/**
* Example of using an angular provider to build an api service.
* @author Jeremy Elbourn (@jelbourn)
*/
/** Namespace for the application. */
var app = {};
/******************************************************************************/
@utsengar
utsengar / EncodeBased64Binary.java
Created October 11, 2011 00:27
Encode a file to base64 binary in Java
import org.apache.commons.codec.binary.Base64;
private String encodeFileToBase64Binary(String fileName)
throws IOException {
File file = new File(fileName);
byte[] bytes = loadFile(file);
byte[] encoded = Base64.encodeBase64(bytes);
String encodedString = new String(encoded);