Skip to content

Instantly share code, notes, and snippets.

Avatar

Russ Sayers russau

View GitHub Profile
@russau
russau / readme
Created Mar 4, 2012
marketplace reviews bookmarklet
View readme
javascript: (function() {
if (!($ = window.jQuery)) { // typeof jQuery=='undefined' works too
script = document.createElement('script');
script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
script.onload = releasetheKraken;
document.body.appendChild(script);
}
else {
releasetheKraken();
}
@russau
russau / WebForm1.aspx
Created May 15, 2012
Evil viewstate crash
View WebForm1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="DynamicControls.WebForm1" %>
<%@ Register src="WebUserControl1.ascx" tagname="WebUserControl1" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
View gist:3076039
byte[] packet = new byte[17*6];
for(int i = 0; i < 6; i++)
packet[i] = 0xff;
View gist:3655520
byte[] badBytes = new byte[] { 0x44, 0x6f, 0x72, 0x66, 0x73, 0x74, 0x72, 0x61, 0xc3, 0x83, 0xc5, 0xb8, 0x65 }; //Dorfstraße
string utf8 = System.Text.Encoding.UTF8.GetString(badBytes);
byte[] fixedBytes = System.Text.Encoding.GetEncoding(1252).GetBytes(utf8);
string allGood = System.Text.Encoding.UTF8.GetString(fixedBytes); //Dorfstraße
View ajax.aspx
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%
System.Net.IPHostEntry host;
string hostname = "rsmazdb.copiliunddin.us-west-2.rds.amazonaws.com";
host = System.Net.Dns.GetHostEntry(hostname);
foreach (System.Net.IPAddress ip in host.AddressList)
{
@russau
russau / s3_hitter.py
Created Dec 5, 2014
s3 redirect diagnose
View s3_hitter.py
import urllib2
import datetime
import time
import socket
domain = "201412051453-oregon-cats.s3.amazonaws.com"
# http://stackoverflow.com/questions/17202364/urllib2-urlopen-adding-host-header
while 1:
@russau
russau / Program.cs
Created Jan 14, 2015
Introduction to KMS
View Program.cs
using Amazon;
using Amazon.KeyManagementService;
using Amazon.KeyManagementService.Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@russau
russau / demo.js
Created Feb 16, 2015
Lambda function for ElasticTranscoder
View demo.js
console.log('Loading event');
var AWS = require('aws-sdk');
exports.handler = function(event, context) {
console.log('Received event:');
console.log(JSON.stringify(event, null, ' '));
// Get the object from the event and show its content type
var bucket = event.Records[0].s3.bucket.name;
var key = event.Records[0].s3.object.key;
var output = Math.random().toString(36).substring(7) + ".webm";
View list-metrics.json
{
"Metrics": [
{
"Namespace": "AWS/EC2",
"Dimensions": [
{
"Name": "InstanceId",
"Value": "i-aaaaaaaa"
}
],
View list-metrics2.json
{
"Metrics": [
{
"Namespace": "AWS/EC2",
"Dimensions": [
{
"Name": "InstanceId",
"Value": "i-aaaaaaaa"
}
],