Skip to content

Instantly share code, notes, and snippets.

View naxhh's full-sized avatar
💻
Devoping

Ignacio Tolstoy naxhh

💻
Devoping
  • Barcelona
View GitHub Profile
function onlyStatic (middleware) {
return function (req, res, next) {
var match = /(\.css|\.eot|\.gif|\.html|\.js|\.png|\.svg|\.ttf|\.woff|\.jpg)($|\?.*$)/ig.exec(req.originalUrl);
if (!match) return next();
middleware(req, res, next);
};
}
//usage
this.use(onlyStatic(express.static(__dirname + "/public")));
@dhrrgn
dhrrgn / gist:10125477
Last active February 26, 2021 18:42
Upgrade Ubuntu OpenSSL to patch Heartbleed
sudo apt-get update
sudo apt-get install -y libssl1.0.0 openssl
# Confirm Build Date is at least Aril 7th 2014
openssl version -a
# Restart all services listed by this command:
sudo lsof -n | grep ssl | grep DEL
# Description:
# Control marathon via hubot
#
# Configuration:
# HUBOT_MARATHON_HOST=marathon.yourcompany.com:8080
#
# Commands:
# hubot marathon - show the instances of all apps
# hubot marathon <id> - show the number of instances for app <id>
# hubot scale <id> <number> - scale app ID to <number> instances
@trikitrok
trikitrok / Rock-paper-scissorsKata.md
Last active August 29, 2015 14:08
Unconditional Rock-paper-scissors kata

In this kata we'll use TDD to develop an object-oriented solution for the Rock-paper-scissors game.

The catch is that we can't use any conditionals, that is, if, switch, ternary operator or any other type of conditionals are not allowed.

It's an introductory kata which will help you to hone your OO skills.

This would be the initial code in Ruby:

class RockPaperScissors
@alexei-led
alexei-led / fix_boot2docker_tsl
Created July 9, 2015 08:19
Fix boot2docker TSL error: "...certificate is valid for 127.0.0.1, 10.0.2.15, not ..." for IP
# SSH to Boot2Docker with `boot2docker ssh`
# add your IP to command bellow, run this command as superuser
/usr/local/bin/generate_cert --host=boot2docker,127.0.0.1,10.0.2.15,192.168.59.103 --ca=/var/lib/boot2docker/tls/ca.pem --ca-key=/var/lib/boot2docker/tls/cakey.pem --cert=/var/lib/boot2docker/tls/server.pem --key=/var/lib/boot2docker/tls/serverkey.pem
@javierarques
javierarques / protractorAPICheatsheet.md
Last active March 3, 2025 17:08
Protractor API Cheatsheet
@marwei
marwei / how_to_reset_kafka_consumer_group_offset.md
Created November 9, 2017 23:39
How to Reset Kafka Consumer Group Offset

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)