Skip to content

Instantly share code, notes, and snippets.

View rrampage's full-sized avatar

Raunak Ramakrishnan rrampage

View GitHub Profile
#include <curses.h>
#include <stdlib.h>
#include <time.h>
int b[32], *d=&b[16], q, v, y;
char*m[]={
"CBA@GFEDKJIHONML",
"@DHLAEIMBFJNCGKO",
"LHD@MIEANJFBOKGC",
"""Example to compute word frequency using simple map/reduce utility from openlibrary.
https://github.com/internetarchive/openlibrary/tree/master/openlibrary/data/mapreduce.py
"""
import sys
import logging
from openlibrary.data import mapreduce
class WordFrequecy(mapreduce.Task):
def map(self, key, value):
"""
Simple preforking echo server in Python.
Python port of http://tomayko.com/writings/unicorn-is-unix.
"""
import os
import sys
import socket
@sathish316
sathish316 / DropwizardAsyncResource.java
Created February 9, 2016 09:19
Dropwizard AsyncResponse usage
package com.xyz.dw.resource;
import com.codahale.metrics.annotation.Timed;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.SettableFuture;
import com.xyz.dw.model.Greeting;
import org.glassfish.jersey.server.ManagedAsync;
import rx.Observable;
import rx.schedulers.Schedulers;
@softwaredoug
softwaredoug / solr-opinons.md
Last active March 6, 2021 20:04
Opinions on using Solr effectively from Doug Turnbull

Solr needs opinions, because Solr documentation gives you way too many options. It's hard to navigate the best practices for using Solr. Some of my opinions based on dozens of Solr projects :)

Prefer preloading static, classic config files over managed schema, config API, or schemaless

Schema files are a good thing. They are declarative, and not letting them change at runtime prevents all kinds of security issues. Further, classic schema / solrconfig support all of Solr's functionality and are well documented with tons of examples online in blog articles and stackoverflow. Using managed schema or the config API takes a lot of experimentation.

Static configurations can also be easily version controlled. As I've learned as a long time Elasticsearch user, this is one of Solr's advantages. Having an API for changing every underlying config option of your index means finding the code that made the change is rather time consuming.

Static configuration is also good separation of concerns. You cleanly separate

@leegao
leegao / Rationale.md
Created July 9, 2011 02:30
JIT for dummies: JIT compiling RPN in python

If you don't care about the explanation, scroll down to find the code, it's 50 some odd lines and written by someone who doesn't know any better. You have been warned.

What it does

This is a very simple proof of concept jitting RPN calculator implemented in python. Basically, it takes the source code, tokenizes it via whitespace, and asks itself one simple question: am I looking at a number or not?

First, let's talk about the underlying program flow. Pretend that you are a shoe connoisseur with a tiny desk. You may only have two individual shoes on that desk at any one time, but should you ever purchase a new one or get harassed by an unruly shoe salesman without realizing that you have the power to say no (or even maybe?), you can always sweep aside one of the two shoes on the desk (the one on the right, because you're a lefty and you feel that the left side is always superior) onto the messy floor, put the other shoe on the right hand side, and then place your newly acquired shoe in

@kaleb
kaleb / aliases
Created October 15, 2011 15:51
Gmail on Mutt
#~/.mutt/aliases
alias nick Nicholas Levandoski <nick.levandoski@auglug.org>
alias tim Timothy Pitt <timothy.pitt@auglug.org>
alias steven Steven Jackson <sjackson@auglug.org>
alias kaleb Kaleb Hornsby <kaleb.hornsby@auglug.org>
alias alug-admin nick, tim, steven
@debojyoti
debojyoti / lenovo_ideapad_330_ubuntu.md
Last active October 15, 2023 20:13
Lenovo ideapad 330 (15ARR) ubuntu issues and there solutions

Lenovo ideapad 330 (15ARR) ubuntu issues and their solutions

Issue-1: None of the ubuntu distros are getting installed

Solution: Ubuntu distros lower than 18.10 will not work in this laptop, as minimum kernal version required is 4.18.

So install ubuntu 18.10 / xubuntu 18.10 / lubuntu 18.10 / kubuntu 18.10 in UEFI mode

Issue-2: Wifi is not working

@wombat
wombat / QRAndLogo.java
Last active December 5, 2023 12:07
QR-Code with embedded logo
// Create new configuration that specifies the error correction
Map<EncodeHintType, ErrorCorrectionLevel> hints = new HashMap<EncodeHintType, ErrorCorrectionLevel>();
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
QRCodeWriter writer = new QRCodeWriter();
BitMatrix bitMatrix = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
// Create a qr code with the url as content and a size of 250x250 px