Skip to content

Instantly share code, notes, and snippets.

View singhai0's full-sized avatar
😩
EHOSTUNREACH

Mridul Singhai singhai0

😩
EHOSTUNREACH
  • San Francisco, CA
View GitHub Profile
@dbechrd
dbechrd / mg
Last active April 20, 2023 16:45
#!/bin/bash
DEBUG=0
VERBOSE=0
CMDS="args|b|br|co|db|nb|pb|pr|rbm|web"
BRANCH_PREFIX="dlb-"
BRANCH_URL_SAFE=""
REPO=`git remote -v | grep -m 1 "(push)" | sed -E "s/.*github\.com[:/](.*)(\.git| ).*/\1/"`
@bjrmatos
bjrmatos / friday_deploy.txt
Last active March 25, 2023 17:57 — forked from mathroc/friday_deploy.txt
Friday Deploy ascii image
┐┌┐┌┐
┘└┘└┘\ₒ/
┐┌┐┌┐ ∕ Friday
┘└┘└┘ノ)
┐┌┐┌┐ deploy,
┘└┘└┘
┐┌┐┌┐ good
┘└┘└┘
┐┌┐┌┐ luck!
│││││
@gene1wood
gene1wood / 01_get_account_id_for_user_ec2instance_role_or_lambda.py
Last active November 9, 2022 16:40
Method to determine your AWS account ID using boto3 for either a user or an ec2 instance or lambda function
import boto3
print(boto3.client('sts').get_caller_identity()['Account'])
@blairanderson
blairanderson / DependencyInjectionInRuby.md
Last active September 3, 2022 04:41
Dependency Injection in Ruby. Originally from Jim Weirich’s blog which does not exist except for googles cache.

Dependency Injection in Ruby 07 Oct 04

Introduction

At the 2004 Ruby Conference, Jamis Buck had the unenviable task to explain Dependency Injection to a bunch of Ruby developers. First of all, Dependency Injection (DI) and Inversion of Control (IoC) is hard to explain, the benefits are subtle and the dynamic nature of Ruby make those benefits even more marginal. Furthermore examples using DI/IoC are either too simple (and don’t convey the usefulness) or too complex (and difficult to explain in the space of an article or presentation). I once attempted to explain DI/IoC to a room of Java programmers (see onestepback.org/articles/dependencyinjection/), so I can’t pass up trying to explain it to Ruby developers.

Thanks goes to Jamis Buck (the author of the Copland DI/IoC framework) who took the time to review this article and provide feedback.

What is Dependency Injection?

@steve-kertes
steve-kertes / get_books_on_shelf.py
Last active April 15, 2022 15:41 — forked from gpiancastelli/goodreads-oauth-example.py
A Python example of how to use OAuth on GoodReads. Includes scripts to pull list of books that are on a shelf and to add all owned books to a shelf.
from string import Template
import oauth2 as oauth
import urlparse
import urllib
import time
import xml.dom.minidom
import sys, getopt
# If you get 'Title Messed Up By Unicode Error' messages try
# export PYTHONIOENCODING=utf-8
@juanplopes
juanplopes / dfa.py
Last active September 28, 2021 16:37
simple dfa in python
class Automaton:
def __init__(self, nstates):
self.transitions = [{} for i in range(nstates)]
self.accept_states = [False] * nstates
def register(self, source_state, char, target_state):
self.transitions[source_state][char] = target_state
def register_accept(self, state):
self.accept_states[state] = True
# Ideally, we would manage async access to stdin/stdout/stderr *without*
# setting them to non-blocking mode, because that can break other processes.
# (See https://github.com/python-trio/trio/issues/174 for much more detail.)
# Of course we can call read/write in a separate thread, but then we lose
# cancellation support.
# This file demonstrates a weird hack to make blocking read/write cancellable,
# and thus at least theoretically possible to integrate into Trio as ordinary
# first-class operations.
diff --git a/diesel/src/lib.rs b/diesel/src/lib.rs
index 28c60a3..18225b2 100644
--- a/diesel/src/lib.rs
+++ b/diesel/src/lib.rs
@@ -3,6 +3,7 @@
//! found in the README.
#![deny(warnings)]
#![cfg_attr(feature = "unstable", feature(specialization))]
+#![cfg_attr(all(test, feature = "unstable"), feature(test))]