Skip to content

Instantly share code, notes, and snippets.

Suresh Prajapati toddlers

Block or report user

Report or block toddlers

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
toddlers / abbreviated-unbound.conf
Created Jan 15, 2019 — forked from bryanjswift/abbreviated-unbound.conf
Unbound ( configuration for local network device testing.
View abbreviated-unbound.conf
# The server clause sets the main parameters.
# Allow network connections outside of localhost
# Don't automatically run in the background because I want to be able to kill it without hunting a pid
do-daemonize: no
# TODO: Change this to your network range, like ` allow`
access-control: allow
# TODO: Change this to your username, or whatever user you want to run/own the `unbound` process
username: "bryanjswift"
toddlers /
Created Jun 29, 2018 — forked from posener/
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

toddlers / gist:de127f24ba917028dc2aaaf5104f8622
Created Dec 12, 2017 — forked from bergantine/gist:4487752
Concatenate files in a directory into a single file. #ruby #donnieclapp
View gist:de127f24ba917028dc2aaaf5104f8622
# Iterates over files and subdirectories in directorie[s] given as arguments
# and adds raw text of those files to merged.txt in the working directory
# where the script is called
# Call like this:
# ruby merge.rb {absolute path portion to delete} {directory to scan} [{directory to scan}]
# For example:
# ruby merge.rb /Users/donnieclapp/Projects/ ~/Projects/htl-website/myproject/static_media/stylesheets
# create or open the merged.txt file for writing (in working directory)
toddlers / function.js
Created Aug 31, 2017 — forked from vgeshel/function.js
AWS Lambda function for forwarding SNS notifications to Slack
View function.js
console.log('Loading function');
const https = require('https');
const url = require('url');
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration
const slack_url = '';
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};
View httpclient.go
package httptimeout
import (
type TimeoutTransport struct {
toddlers / httpclient.go
Created May 25, 2017 — forked from dmichael/httpclient.go
Light wrapper for the Go http client adding (essential) timeouts for both connect and readwrite.
View httpclient.go
package httpclient
import (
type Config struct {
ConnectTimeout time.Duration
toddlers /
Created Apr 20, 2017 — forked from jwbensley/
Print network soft IRQ back-pressure stats
# A variation of:
# by /
usage() {
cat >&2 <<EOI

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

You can’t perform that action at this time.