Skip to content

Instantly share code, notes, and snippets.

View endeepak's full-sized avatar

Deepak Narayana Rao endeepak

View GitHub Profile
@soekul
soekul / hash_ring.py
Created June 9, 2017 15:44 — forked from reorx/hash_ring.py
Consistent hash implementation in Python.
# -*- coding: utf-8 -*-
"""
hash_ring
~~~~~~~~~~~~~~
Implements consistent hashing that can be used when
the number of server nodes can increase or decrease (like in memcached).
Consistent hashing is a scheme that provides a hash table functionality
in a way that the adding or removing of one slot
does not significantly change the mapping of keys to slots.
@cherti
cherti / alert.sh
Created December 9, 2016 13:47
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
@voidfiles
voidfiles / gist:a24fea5fd56a8f81c361c84bd29e8411
Created September 23, 2016 21:47
Multiservice Jenkinsfile Reuse

Let me know if this sounds, right.

I work at a company that has N services. Each service has it's own deployable artifact. Each artifact creation process is unique, but the pipeline, and deployment processes are similar. As we grow we are looking to create more services. I would like to manage this complexity in a couple of ways.

  1. We use Jenkins
  2. I'd like to use Jenkinsfile's to manage the jobs
  3. The artifact process should stay unique, some shared code loaded via fileLoader.fromGit
  4. I plan on using a shared deployment job configured via params
  5. I plan on using a shared pipeline job configured via params
@LeonardoCardoso
LeonardoCardoso / gitzip.sh
Last active October 9, 2023 22:38
Zip folder ignoring files listed on .gitignore
#...
function gitzip() {
git archive -o $@.zip HEAD
}
#... gitzip ZIPPED_FILE_NAME
@tjanczuk
tjanczuk / xpub-xsub.js
Created August 24, 2015 23:59
How to connect 5 publishers with 5 subscribers over TCP using ZeroMQ's XPUB/XSUB proxy
// How to connect 5 publishers with 5 subscribers
// over TCP using ZeroMQ's XPUB/XSUB proxy.
// sub (connect)
// <-8701->
// (bind) xpub <---> xsub (bind)
// <-8700->
// (connect) pub
var zmq = require('zmq');
@jbdietrich
jbdietrich / python_flask_jwt.py
Last active December 8, 2019 18:58
A naive implementation of Zendesk's JWT-based Remote Auth for Flask
# This example relies on you having installed PyJWT, `sudo easy_install PyJWT` - you can
# read more about this in the GitHub repository https://github.com/progrium/pyjwt
from flask import Flask, request, redirect
import time
import uuid
import jwt
# insert token here
app.config['SHARED_KEY'] = ''
@reyjrar
reyjrar / elasticsearch.yml
Last active May 12, 2023 11:58
ElasticSearch config for a write-heavy cluster
##################################################################
# /etc/elasticsearch/elasticsearch.yml
#
# Base configuration for a write heavy cluster
#
# Cluster / Node Basics
cluster.name: logng
# Node can have abritrary attributes we can use for routing
@passcod
passcod / dom-loaded-test.html
Created May 26, 2012 08:29
onload, readyState, and DOMContentLoaded
<!DOCTYPE html>
<html>
<head>
<script>
window.onload = function () {
console.log(''+(+new Date)+': Onload fired');
};
document.onreadystatechange = function () {
console.log(''+(+new Date)+': Ready state changed');
@dciccale
dciccale / demo.html
Last active January 22, 2021 10:40
Styling radios & checkboxes using CSS3 (only for webkit)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Styling radios &amp; checkboxes using CSS3</title>
<link rel="stylesheet" media="screen" href="styles.css" >
</head>
<body>
<h1>Styling radios &amp; checkboxes using CSS3</h1>
@pathawks
pathawks / OpenGraph for Blogger.md
Last active October 28, 2023 23:41
OpenGraph for Blogger

Adding Open Graph metadata to Blogger is easy. Simply copy the code below and paste it into your template after the <header> tag.

A couple notes:

  • og:locale Should probably actually reflect the blog's locale instead of just being a hardcoded string. Unfortunately, Blogger only gives us en-us with a hyphen, instead of an underscore, so that won't work.
  • If you're using your blog as a personal profile, you may consider changing the second og:type from website to profile and adding your personal information
  • og:image Is only supplied if Blogger finds an image in the current post. However, not supplying og:image is invalid. You could provide an alternate image of your blog logo, or a Gravatar.
  • If you do something cool with this, I'd love to hear about it. pathawks@shortmail.com