Skip to content

Instantly share code, notes, and snippets.

View vagmi's full-sized avatar

Vagmi Mudumbai vagmi

View GitHub Profile
Begin by enclosing all thoughts within <thinking> tags, exploring multiple angles and approaches.
Break down the solution into clear steps within <step> tags. Start with a 20-step budget, requesting more for complex problems if needed.
Use <count> tags after each step to show the remaining budget. Stop when reaching 0.
Continuously adjust your reasoning based on intermediate results and reflections, adapting your strategy as you progress.
Regularly evaluate progress using <reflection> tags. Be critical and honest about your reasoning process.
Assign a quality score between 0.0 and 1.0 using <reward> tags after each reflection. Use this to guide your approach:
0.8+: Continue current approach
0.5-0.7: Consider minor adjustments
Below 0.5: Seriously consider backtracking and trying a different approach
@vagmi
vagmi / hello.go
Created August 13, 2018 17:21
AS2 (RFC 4130) in Golang
package main
import (
"bytes"
"crypto"
_ "crypto/md5" // for crypto.MD5
_ "crypto/sha1" // for crypto.SHA1
_ "crypto/sha512" // for crypto.SHA384 & 512
"crypto/x509"
"encoding/asn1"

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

var enableMultipleViewFolders = function(express) {
var eView= express.get('view');
var lookupProxy = eView.prototype.lookup;
eView.prototype.lookup = function (view) {
if (this.root instanceof Array) {
var opts = {};
var matchedView = null,
roots = this.root;
@vagmi
vagmi / app.js
Created April 1, 2014 22:03 — forked from simme/app.js
// Load Ember into the global scope by requiring it
require('ember');
// Go have fun
var app = Ember.Application.create();
var lib = require("./manifest.js");
lib.mkmanifest({
filename : "cache"
,path : "../coffee"
,version : "02"
,exclude : ['/.DS_Store', '/.htaccess', '/cache.manifest']
/*
,network : ['/connect.php','/read.php']
,fallback : ['/offline.html']
@vagmi
vagmi / oracle.md
Created April 9, 2013 04:28 — forked from dlokesh/oracle.md

Oracle sqls

find all constraints of a table

select * from all_constraints where table_name='TABLE_NAME' and owner='OWNER_NAME';

find all primary keys of a table

SELECT cols.table_name, cols.column_name, cols.position, cons.status, cons.owner
@vagmi
vagmi / index.html
Last active October 11, 2015 19:58 — forked from AgalyaLoganathan/index.html
d3 segment chart
<!doctype html>
<html>
<head>
<title>Segment Graph</title>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet">
<style>
#segmentChart {
float: left;
width: 400px;
height: 100px;
@vagmi
vagmi / index.html
Created October 17, 2012 15:21 — forked from AgalyaLoganathan/index.html
d3 segment chart
<!doctype html>
<html>
<head>
<title>Segment Graph</title>
<style>
#segmentChart {
width: 400px;
height: 100px;
}
</style>