Skip to content

Instantly share code, notes, and snippets.

@jesselang
jesselang / malware_scanner.py
Last active October 6, 2015 17:57
Script to assist in cleaning up one type of injection from PHP malware
#!/usr/bin/env python
# Script to assist in cleaning up one type of injection from PHP malware.
# Author: Jesse Lang | http://jesselang.com/
# Use it with "find" like this:
# $ for FILE in $(find -iname *.php); do python malware_cleanup.py $FILE; done
# This script takes one argument, a file path.
# The file is opened and scanned for a match.
# The user is given the option of cleaning or deleting the file, or doing nothing.
# If repairing the file would result in an empty file, the file is deleted instead.
@jesselang
jesselang / migrate-repo.sh
Last active October 6, 2015 17:58
Migrate a git repo from one instance of Altassian Stash/BitBucket to another
#!/bin/sh
# Script to migrate git repos from one instance of Altassian Stash/BitBucket to another.
# Author: Jesse Lang | http://jesselang.com/
REPO=/tmp/migrate-repo-mirror-${USER}
if [ $# -lt 2 ]; then
echo "usage: migrate-repo.sh <current-url> <new-url>"
exit 1
fi
@jesselang
jesselang / prune-origin.sh
Created October 23, 2015 20:55
One-liner to keep your origin remote tidy (assuming you only care about branches being merged to master)
git fetch --prune && git branch -r --merged origin/HEAD | sed "s/origin\///" | grep -v 'master\|HEAD' | xargs -n 1 git push --delete origin && git fetch --prune
@jesselang
jesselang / example.yml
Created January 23, 2016 04:22
Example ansible playbook to access facts from a group of hosts from another host
---
# Execute using ansible-playbook -i hosts example.yml
- hosts: web
gather_facts: yes
- hosts: db
gather_facts: no # optional; speed optimization
tasks:
- name: Display addresses of all web hosts
- debug: msg={{ hostvars[item].ansible_eth0.ipv4.address }}
@jesselang
jesselang / verify_utf.adb
Created January 24, 2016 18:06
I wrote this in May of 2010, and don't remember what it does, but better it being forgotten here than on a hard drive.
with Ada.Text_IO;
with Ada.Command_Line;
with Ada.Streams.Stream_IO;
use Ada.Streams;
procedure Verify_UTF is
First_Word : constant Stream_Element_Array (1 .. 2) := (16#fe#, 16#ff#); -- http://en.wikipedia.org/wiki/Byte_order_mark
Second_Word : constant Stream_Element_Array (1 .. 2) := (16#00#, 16#22#);
#!/bin/bash
if [ $# -ne 1 ]
then
echo "Performs a number of encodings on the first argument string"
echo "Usage: `basename $0` {string}"
exit 1
fi
printf "n# String Scrambles:n"
@jesselang
jesselang / asciiart.txt
Created September 19, 2018 18:37
Asciiart I'm in frequent need of
¯\_(ツ)_/¯
(╯°□°)╯︵ ┻━┻
(╯︵╰,)
@jesselang
jesselang / giphy.txt
Created September 19, 2018 18:39
giphy URLs I'm in frequent need of
IT Crowd - Hello IT Have you tried turning it off and on again.
https://i.giphy.com/F7yLXA5fJ5sLC.gif
Sandlot - You're killing me Smalls
http://i.giphy.com/PtQrzJUJ7Q9d6.gif
Hurcules - Disappointed!
http://i.giphy.com/L02M3FJhkF19S.gif
@jesselang
jesselang / devops.md
Created September 19, 2018 18:49
Notes from B-Sides MSP 2016 (I think)

DevOps - Fast, Furious, Secure

We don't make the money, we save the money for the company.

Traditional approach to security like the TSA, Gate-based waterfall methodology

Embedding security earlier - "move it to the left" Doesn't work with iterative process.

Keybase proof

I hereby claim:

  • I am jesselang on github.
  • I am jesselang (https://keybase.io/jesselang) on keybase.
  • I have a public key ASCXafSYUUuqog_KjVKt0_Oqv9DQluqsfuLKwT6nV171zQo

To claim this, I am signing this object: