Skip to content

Instantly share code, notes, and snippets.

View MrDHat's full-sized avatar
🍟

Akshay Katyal MrDHat

🍟
View GitHub Profile
@ashrithr
ashrithr / kerberos_setup.md
Last active July 20, 2024 20:06
Set up kerberos on Redhat/CentOS 7

Installing Kerberos on Redhat 7

This installation is going to require 2 servers one acts as kerberos KDC server and the other machine is going to be client. Lets assume the FQDN's are (here cw.com is the domain name, make a note of the domain name here):

  • Kerberos KDC Server: kdc.cw.com
  • Kerberos Client: kclient.cw.com

Important: Make sure that both systems have their hostnames properly set and both systems have the hostnames and IP addresses of both systems in

var mongoose = require('mongoose');
var glob = require("glob");
var path = require('path');
mongoose.connect('mongodb://username:password@localhost/dbname');
/**
* We check if the connection is ok
@zaach
zaach / map-reduce.js
Last active December 20, 2015 17:19
Map reduce with p-promises, based on https://gist.github.com/kriskowal/359801
// Map/Reduce with Promises
var p = require("p-promise");
// to simulate a long latency, promise-returning API
var delay = function (timeout) {
var deferred = p.defer();
setTimeout(function () {
deferred.resolve();
}, timeout);
return deferred.promise;
function inherit(proto, literal) {
var result = Object.create(proto);
for (var prop in literal) {
if (literal.hasOwnProperty(prop)) {
result[prop] = literal[prop];
}
}
return result;
}
@jaredhirsch
jaredhirsch / gist:4971859
Created February 17, 2013 15:19
all about ETags

ETags: a pretty sweet feature of HTTP 1.1

HTTP caching review

HTTP provides two ways for servers to control client-side caching of page components:

  • freshness may be based on a date or a token whose meaning is app-specific
  • whether or not the client needs to confirm the cached version is up-to-date with the server

This breaks down as follows:

  • Cache locally and don't check before using.
@spacetime
spacetime / cyberroam.sh
Last active December 11, 2015 14:59
Simple loop to login every seven minutes. This one tested on Mac OSX. Revision 2 on Linux.
#!/bin/bash
while true
do
curl -d "mode=191&username=UUUU&password=PPPPPP" http://172.10.1.2:8090/httpclient.html -o /dev/null
sleep $[7*60];
done
@spacetime
spacetime / nexus4.py
Created November 14, 2012 21:38
Nexus 4 availability email script (using sendmail)
#!/usr/bin/python
from urllib import urlopen
import smtplib
import logging
import os
sender = 'youremail@here.com'
recipients = ['abc@gmail.com'
'abc@def.com',
'asd@asd.com',
@domenic
domenic / promises.md
Last active June 24, 2024 03:11
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@jedp
jedp / gist:3778932
Created September 24, 2012 22:50
B2G repo setup and build quickstart

B2G Quickstart for Payments and Identity

Before you begin: You want to do this on a Mac. I have been using Linux for months, and unresolved redraw issues (white screen of death) are killing me. Mac works great. Use OSX.

This sets you up to make two separate targets:

  • One for a desktop [simulator] [1]
  • One for the Unagi [device] [2]

These are the moving parts:

  • [mozilla-inbound repo] [3] clone (hg)
@chrisjacob
chrisjacob / README.md
Created July 16, 2011 11:23
How to: GitHub Pages "gh-pages" branch for User & Organization Pages

GitHub Pages "Normal" Setup for User & Organization Pages

Let’s say your GitHub username is “alice”. If you create a GitHub repository named alice.github.com, commit a file named index.html into the master branch, and push it to GitHub, then this file will be automatically published to http://alice.github.com/... The same works for organizations.

Read more here: http://pages.github.com/

However... the downside of this is that anyone that forks this repo won't get it as a GitHub Pages repo when they are working on it... because they have a different GitHub "username" (or "organisation name").

So the trick is to not use a master branch as the documentation tells you... rather, use a gh-pages branch, as you would for your other "Project Pages".