Skip to content

Instantly share code, notes, and snippets.

@kjlubick
kjlubick / HTTPServer.java
Last active September 3, 2015 20:25
Example Jetty Exploit
import org.eclipse.jetty.server.Server;
public static HTTPServer startUpAnHTTPServer(WebQueryInterface wqi, UserManager um)
{
HTTPServer httpServer = new HTTPServer();
if (HTTPServer.getUserManager() == null)
{
userManager = um;
}
//Exploitable, this port can be accessed by anyone on the local network
@kjlubick
kjlubick / InstallingMeld
Last active November 2, 2023 02:49
How to install Meld on Windows and getting it set up with Git
After installing it http://sourceforge.net/projects/meld-installer/
I had to tell git where it was:
git config --global merge.tool meld
git config --global diff.tool meld
git config --global mergetool.meld.path “C:\Program Files (x86)\Meld\meld\meld.exe”
And that seems to work. Both merging and diffing with “git difftool” or “git mergetool”
@kjlubick
kjlubick / fb-GetSource.java
Created June 10, 2014 14:39
How to access the source code from FindBugs
private String[] getSourceLines(Method obj) {
BufferedReader sourceReader = null;
String[] sourceLines;
try {
srcLineAnnotation = SourceLineAnnotation.forEntireMethod(getClassContext().getJavaClass(), obj);
if (srcLineAnnotation != null)
{
SourceFinder sourceFinder = AnalysisContext.currentAnalysisContext().getSourceFinder();
@kjlubick
kjlubick / Imageuploader.java
Created July 2, 2014 19:46
Uploading images using Apache HTTPComponents (HTTPClient, MultipartEntityBuilder)
//The following is in snippet form.
//It shows 2 ways to upload files, the first is the cannonical way, if you have the image on disk
//the second is a way to upload it without having to write a modified image to disk (in this instance, a cropped image)
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
@kjlubick
kjlubick / .jshintrc
Last active August 29, 2015 14:03
JSHint for Sublime Text 3 settings
{
// Details: https://github.com/victorporof/Sublime-JSHint#using-your-own-jshintrc-options
// Example: https://github.com/jshint/jshint/blob/master/examples/.jshintrc
// Documentation: http://www.jshint.com/options/
"browser": true,
"devel": true,
"esnext": true,
"jquery":true,
"globals": {},
"globalstrict": false,
@kjlubick
kjlubick / readme.md
Last active August 29, 2015 14:05
Google search for youtube videos containing certain words
@kjlubick
kjlubick / todo.md
Last active August 29, 2015 14:05 — forked from shader/todo.md

[3/7] Major UI

  • Use urls for filtering so that browser history works
  • Application selector checkboxes instead of dropdown
  • Video thumbnails in tool block
    • Display thumbnail for user videos, instead of just names
    • Add 'request video' thumbnail for users without videos
  • Add instrumentation
    • Get list of actions to instrument
  • Fix Sharing
@kjlubick
kjlubick / clearout.java
Last active August 29, 2015 14:06
Clearing out folders - this deletes all files and folders (recursively) in a folder
public static boolean clearOutDirectory(File rootDirectory)
{
if (!rootDirectory.exists() || (rootDirectory.isDirectory() && rootDirectory.listFiles().length == 0))
{
return true;
}
return recursivelyClearDirectory(rootDirectory);
}
private static boolean recursivelyClearDirectory(File parentDirectory)
@kjlubick
kjlubick / instructions.md
Last active August 29, 2015 14:06
Decrypting a password-encrypted pdf (Windows)

This works even if the pdf is password protected with a user password (instead of an owner password), but you must have the password. It won't recover the password, just decrypt it.

  1. Download pdfcrypt1.0.zip from http://soft.rubypdf.com/software/pdfcrypt
  2. Put the encrypted pdf in the same directory as pdfcrypt.exe (and rename it to something w/o spaces like enc.pdf)
  3. Execute .\pdfcrypt.exe enc.pdf output.pdf decrypt [password] which will decrypt the pdf to output.pdf.
@kjlubick
kjlubick / activepresenterStart.au3
Last active August 29, 2015 14:06
Automatically running ActivePresenter 4.0.1 to record screencasts (record desktop activities) at 5 fps with no control panel/hotkeys
Local $id = InputBox("Participant ID", "Enter userid (e.g. P123)")
If $id <> "" Then
Run("C:\Program Files (x86)\ATOMI\ActivePresenter\ActivePresenter.exe")
WinWaitActive("ActivePresenter")
Send("^n")
Send($id)