Skip to content

Instantly share code, notes, and snippets.

View jabrena's full-sized avatar

Juan Antonio Breña Moral jabrena

View GitHub Profile
@erjjones
erjjones / JekyllListAllPosts.html
Created March 8, 2012 03:22
Jekyll List All Posts
{% for post in site.posts %}
<h3><a href="{{ post.url }}">{{ post.title }}</a></h3>
<p><small><strong>{{ post.date | date: "%B %e, %Y" }}</strong> . {{ post.category }} . <a href="http://erjjones.github.com{{ post.url }}#disqus_thread"></a></small></p>
{% endfor %}
@btoone
btoone / curl.md
Last active April 2, 2024 20:18
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@nottsknight
nottsknight / install-java.sh
Last active April 27, 2017 20:54
BASH script to install the Java Development Kit. User must download the JDK themselves, and then give the path to the downloaded .tar.gz archive as the only command-line argument.At the end of the script, a series of menus appear, presenting all the different places where the system can find the 'java' (or javac, etc.) command in a numbered list…
#!/usr/bin/env bash
# Abort if not super user
if [[ ! `whoami` = "root" ]]; then
echo "You must have administrative privileges to run this script"
echo "Try 'sudo ./install-java.sh'"
exit 1
fi
# Check that the file is a JDK archive
@ayyytam
ayyytam / TwentyFourtyEight
Last active August 4, 2022 18:02
2048 terminal game
// Terminal 2048
// By: Andrew Tam
// There is currently no GUI for this game and is played completely on the Terminal.
// Type in the instructions such as "up", "down", "left", "right" to move the tiles
// Type in "reset" to reset the game
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Random;
@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active October 21, 2022 20:10
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@mallim
mallim / logstash.conf
Created July 19, 2016 03:15
Logstash config for Spring Boot's default logging
input {
file {
type => "java"
tags => [ "fornax-data-share-eureka" ]
# Logstash insists on absolute paths...
path => "D:/fornax-data-share-runtime/eureka/fornax-data-share-eureka.log"
codec => multiline {
pattern => "^%{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{TIME}.*"
negate => "true"
what => "previous"
@jeresig
jeresig / block-puzzle.js
Created December 27, 2016 21:15
Super-hacky solver for the "Gopher Holes" puzzle: http://amzn.to/2hqLO2V
/**
* Super-hacky solver for the "Gopher Holes" puzzle:
* http://amzn.to/2hqLO2V
*
* Note: I assumed that the blocks would be going vertically in one direction
* and horizontally in another.
*
* Also: I wrote this for fun over the holidays - I'm sure this code is
* terrible and could be improved. It was good enough for my needs!
*

[Know about it][Understanding][Clear understanding]

NOVICE

CONCEPTS

  • xxx Immutable Data
  • xxx Second-Order Functions
  • xxx Constructing & Destructuring
  • xxx Function Composition
  • xxx First-Class Functions & Lambdas
@PocasPedro
PocasPedro / SpeedOfLight.java
Created September 25, 2017 17:15
Java Fundaments for Kids - Exercise 1
/**
Simple Program that prints the Speed of Light in meters per second. Coded by Pedro.
*/
public class SpeedOfLight {
public static void main(String[] args) {
//I have used an integer because the needed value fits the range of an integer. I have not used a DataType wrapper here to keep it simple.
int sol = 299792458;
// Prints "The light speed is ... m/s" to the terminal window.
@msievers
msievers / [Spring, JMH] Howto integrate JMH benchmarks with Spring.md
Last active March 23, 2024 21:12
[Spring, JMH] Howto integrate JMH benchmarks with Spring

Motivation

Integrate JMH (Java Microbenchmarking Harness) with Spring (Boot) and make developing and running benchmarks as easy and convinent as writing tests.

Idea

Wrap the necessary JMH boilerplate code within JUnit to benefit from all the existing test infrastructure Spring (Boot) provides. It should be as easy and convinent to write benchmarks as it is to write tests.

TL;DR;