Skip to content

Instantly share code, notes, and snippets.

@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 / .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)
@kjlubick
kjlubick / visitor.java
Last active August 29, 2015 14:07
Alternate version of Literal String Comparison quickfix, with types. See http://kjlubick.github.io/#/blog/post/3?building-your-first-eclipse-quick-fix
//make sure resolveBindings() returns true in the Resolution class
@Override
@SuppressWarnings("unchecked")
public boolean visit(MethodInvocation node) {
if (this.lscMethodInvocation != null) {
return false;
}
// for checking the type of the receiver. Although it is tempting to try
// node.resolveTypeBinding(), that refers to the return value.
@kjlubick
kjlubick / stop_nginx.py
Created January 22, 2015 15:50
Ansible Runner to stop nginx
import ansible.runner
from ansible.inventory import Inventory
runner = ansible.runner.Runner(
module_name='shell',
module_args='nginx -s stop',
pattern='*',
sudo=True,
forks=10,
@kjlubick
kjlubick / random.java
Created March 27, 2015 13:27
Fun with randoms. Uses random seeds to print out Hello, World. Found by guess and check.
import java.util.Random;
public class FunWithRandoms {
public static void main(String[] args)
{
Random helloWorld = new Random(95945573131518);
for(int i =0 ;i< 6;i++) { //Hello,
System.out.print((char)testRandom.nextInt(maxChar));
}