Skip to content

Instantly share code, notes, and snippets.

View cherian's full-sized avatar

Cherian Thomas cherian

View GitHub Profile
Here is your thinking framework.
You are a world class expert in all domains. Your intellectual firepower, scope of knowledge, incisive thought process, and level of erudition are on par with the smartest people in the world. Answer with complete, detailed, specific answers. Process information and explain your answers step by step. Verify your own work. Double check all facts, figures, citations, names, dates, and examples. Never hallucinate or make anything up. If you don't know something, just say so. Your tone of voice is precise, but not strident or pedantic. You do not need to worry about offending me, and your answers can and should be provocative, aggressive, argumentative, and pointed. Negative conclusions and bad news are fine. Your answers do not need to be politically correct. Do not provide disclaimers to your answers. Do not inform me about morals and ethics unless I specifically ask. You do not need to tell me it is important to consider anything. Do not be sensitive to anyone's feelings or to
Thinking Guidelines
1. Expert Framing
Frame questions from a domain-expert perspective, not surface-level. Assume you have context and push for the sophisticated, nuanced details a senior practitioner would care about. Avoid generic "what do you want?" questions—instead, explicitly assign a high-level persona.
Application: "Act as the ultimate expert. Evaluate this strategy and provide the nuanced details that a senior practitioner would focus on."
2. First-Principles Reasoning
Ask questions that force decomposition of assumptions. Don't accept the first framing—probe why something is needed, what the underlying constraints really are, and whether the stated goal is actually the right goal. Use "deconstruct the problem" thinking to surface hidden requirements.
def orientation(self):
exif = self._img._getexif()
if exif is None:
return 0
orientation = 0x0112
return exif.get(orientation, 0)
from PIL import Image
class CTImage(object):
def rotate(self, degree):
self._img = self._img.rotate(degree, expand=True)
(self.width,self.height) = self._img.size
return self
def orientation(self):
exif = self._img._getexif()
if exif is None:
return 0
import ExifTags
import Image
img = Image.open(filename)
print(img._getexif().items())
exif=dict((ExifTags.TAGS[k], v) for k, v in img._getexif().items() if k in ExifTags.TAGS)
if not exif['Orientation']:
img=img.rotate(90, expand=True)
img.thumbnail((1000,1000), Image.ANTIALIAS)
img.save(output_fname, "JPEG")
@cherian
cherian / .tmux.conf
Created June 1, 2012 00:24
Tmux config
set-option -g prefix `
set-option -g pane-active-border-fg green
set-option -g pane-active-border-bg yellow
#set-option -g pane-border-fg white
set-option -g pane-border-bg black
unbind %
bind-key s split-window
bind-key v split-window -h
@cherian
cherian / uri.js
Created May 9, 2012 04:35 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@cherian
cherian / eyewonder.js
Created October 26, 2011 03:23 — forked from kemayo/eyewonder.js
Eyewonder XSS
document.write('<style type="text/css">body{padding); margin:0}</style>');
document.write('<iframe id="iwonder_hack" src="http://' + location.host + '/" width="100%" height="100%" style="border:0;padding:0;margin:0"></iframe>');
setTimeout(function(){
var frmdoc = document.getElementsByTagName('iframe')[0].contentWindow.document
,rotation = 0
,links = frmdoc.getElementsByTagName('a')
,images = frmdoc.getElementsByTagName('img')
,props = ['transform', 'WebkitTransform', 'msTransform', 'MozTransform', 'OTransform']
,transform = function(elem, trans) {
for (var i = 0; i < props.length; i++) {
@cherian
cherian / .inputrc
Created September 13, 2011 02:23
Inputrc
set completion-ignore-case on
set completion-prefix-display-length 2
Control-j: menu-complete
Control-k: menu-complete-backward
set show-all-if-ambiguous on
set show-all-if-unmodified on
set completion-map-case on
@cherian
cherian / setup-statsd.sh
Created July 10, 2011 07:24 — forked from jqr/setup-statsd.sh
Minor changes to statsd installation
# install git
sudo apt-get install -y g++ curl libssl-dev apache2-utils
sudo apt-get install -y git-core
mkdir ~/src
cd ~/src
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node