Skip to content

Instantly share code, notes, and snippets.

😩
EWOULDBLOCK

Mridul Singhai singhai0

😩
EWOULDBLOCK
  • San Francisco, CA
Block or report user

Report or block singhai0

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
@juanplopes
juanplopes / dfa.py
Last active Aug 13, 2019
simple dfa in python
View dfa.py
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
@steve-kertes
steve-kertes / get_books_on_shelf.py
Last active Jun 26, 2019 — 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.
View get_books_on_shelf.py
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
@clayton
clayton / ffmpeg-install.sh
Created Aug 9, 2013
Install FFMPEG on OS X with HomeBrew to convert Mp4 to WebM
View ffmpeg-install.sh
# Installation
brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid
# Easy Peasy
ffmpeg -i video.mp4 video.webm
@blairanderson
blairanderson / DependencyInjectionInRuby.md
Last active Aug 16, 2019
Dependency Injection in Ruby. Originally from Jim Weirich’s blog which does not exist except for googles cache.
View DependencyInjectionInRuby.md

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?

@bjrmatos
bjrmatos / friday_deploy.txt
Last active Feb 2, 2018 — forked from mathroc/friday_deploy.txt
Friday Deploy ascii image
View friday_deploy.txt
┐┌┐┌┐
┘└┘└┘\ₒ/
┐┌┐┌┐ ∕ Friday
┘└┘└┘ノ)
┐┌┐┌┐ deploy,
┘└┘└┘
┐┌┐┌┐ good
┘└┘└┘
┐┌┐┌┐ luck!
│││││
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active Aug 24, 2019
HTTP Streaming (or Chunked vs Store & Forward)
View http_streaming.md

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@patik
patik / how-to-squash-commits-in-git.md
Last active Aug 23, 2019
How to squash commits in git
View how-to-squash-commits-in-git.md

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@gene1wood
gene1wood / 01_get_account_id_for_user_ec2instance_role_or_lambda.py
Last active May 22, 2019
Method to determine your AWS account ID using boto3 for either a user or an ec2 instance or lambda function
View 01_get_account_id_for_user_ec2instance_role_or_lambda.py
import boto3
print(boto3.client('sts').get_caller_identity()['Account'])
View benchmark.patch
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))]
@fchollet
fchollet / classifier_from_little_data_script_3.py
Last active Aug 21, 2019
Fine-tuning a Keras model. Updated to the Keras 2.0 API.
View classifier_from_little_data_script_3.py
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
You can’t perform that action at this time.