Skip to content

Instantly share code, notes, and snippets.

View goyalankit's full-sized avatar
🏠
Working from home

Ankit Goyal goyalankit

🏠
Working from home
View GitHub Profile
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active April 17, 2024 10:51
Backend Architectures Keywords and References
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@ggPeti
ggPeti / spiral.rb
Last active December 26, 2015 17:39
Procedural Ruby solution for the Spiral task
def spiral(h, w, r, c)
spiral = []
step_counts = (1..Float::INFINITY).lazy.flat_map { |n| [n, n] }
directions = [:up, :left, :down, :right].cycle
while spiral.length < h * w
spiral << (r - 1) * w + c if r.between?(1, h) && c.between?(1, w)
if (current_step_count ||= 0).zero?
@ncw
ncw / README.txt
Last active February 20, 2024 19:30 — forked from spikebike/client output
Client side certificates with go
This demonstrates how to make client side certificates with go
First generate the certificates with
./makecert.sh test@test.com
Run the server in one terminal
go run server.go
@goyalankit
goyalankit / bash_to_zsh_history.rb
Last active October 28, 2023 05:07
Import bash history to zsh history.
#################################################################
# = This script transfers bash history to zsh history
# = Change bash and zsh history files, if you don't use defaults
#
# = Usage: ruby bash_to_zsh_history.rb
#
# = Author: Ankit Goyal
#################################################################
# change if you don't use default values
@jpsim
jpsim / JAZMusician.h
Created July 7, 2014 09:25
SourceKit Playground
//
// JAZMusician.h
// JazzyApp
//
#import <Foundation/Foundation.h>
/**
JAZMusician models, you guessed it... Jazz Musicians!
From Ellington to Marsalis, this class has you covered.
@softwaredoug
softwaredoug / asyncio.md
Last active January 3, 2019 20:38
Python Asyncio Notes

This is a document full of notes of all the things that have hung me up getting into Python's new asyncio library. I mostly use it for tools that schlep data around between file systems, databases, and search engines for work. So lots of io. Usually I use gevent and python 2.7. But recently I've been trying to get more into asyncio and here I'm going to document all the things that I felt important to know or that tripped me up.

1. Thoroughly understand yield, and non asyncio coroutines

The first thing you need to do is write some coroutines without asyncio. This means understanding the yield keyword and how it can be used to create generators. Then next the protocol for sending/receiving from generator objects.

Recall generators are a special kind of iterator. When you specify a generator like so, you can use it in a for loop:

def generator()

for i in range(0, 5):

@vmarmol
vmarmol / client.go
Created February 9, 2015 23:21
Simple Go-based HTTP streaming via HTTP and websockets.
package main
import (
"encoding/json"
"flag"
"io"
"net/http"
"github.com/golang/glog"
"golang.org/x/net/websocket"
@nerdalert
nerdalert / Netfilter-IPTables-Diagrams.md
Last active April 9, 2024 09:18
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.