Skip to content

Instantly share code, notes, and snippets.

@janosgyerik
janosgyerik / passenger_wsgi.py
Last active May 8, 2020
passenger_wsgi.py for a django site
View passenger_wsgi.py
projectname = 'bashoneliners'
virtualenv_root = '/path/to/virtualenv/' + projectname
import sys
import os
INTERP = os.path.join(virtualenv_root, 'bin', 'python')
if sys.executable != INTERP:
os.execl(INTERP, INTERP, *sys.argv)
View read-objects-form-file.java
try (FileInputStream fis = new FileInputStream(path);
ObjectInputStream ois = new ObjectInputStream(fis)) {
Contact[] loaded = (Contact[]) ois.readObject();
System.out.println(Arrays.toString(loaded));
}
@janosgyerik
janosgyerik / print-cookie.png
Created Apr 19, 2020
Print document.cookie XSS
View print-cookie.png
View deeds.csv
We can't make this file beautiful and searchable because it's too large.
DOCUMENT ID,CRFN,COLLATERAL,# of PAGES,REEL-PAGE,EXPIRATION DATE,DOC TYPE,FILE NUMBER,ASSESSMENT DATE,DOC DATE,RECORDED/FILED,SLID#,DOC AMOUNT,BOROUGH,% TRANSFERRED,RPTT#,MAP SEQUENCE#,MESSAGE,PARTY1-NAME,PARTY1-ADDRESS1,PARTY1-ADDRESS2,PARTY1-CITY,PARTY1-STATE,PARTY1-ZIP,PARTY1-COUNTRY,PARTY2-NAME,PARTY2-ADDRESS1,PARTY2-ADDRESS2,PARTY2-CITY,PARTY2-STATE,PARTY2-ZIP,PARTY2-COUNTRY,PARTY3-NAME,PARTY3-ADDRESS1,PARTY3-ADDRESS2,PARTY3-CITY,PARTY3-STATE,PARTY3-ZIP,PARTY3-COUNTRY,PARCELS-BOROUGH,PARCELS-BLOCK,PARCELS-LOT,PARCELS-PARTIAL,PARCELS-PROPERTY TYPE,PARCELS-EASEMENT,PARCELS-AIR RIGHTS,PARCELS-SUBTERRANEAN RIGHTS,PARCELS-PROPERTY ADDRESS,PARCELS-UNIT,PARCELS-REMARKS,REFERENCES-CRFN,REFERENCES-DOCUMENT ID,REFERENCES-BOROUGH,REFERENCES-YEAR,REFERENCES-REEL,REFERENCES-PAGE,REFERENCES-FILE NBR
View MergeSort.java
import java.util.ArrayList;
import java.util.List;
public class MergeSort {
public static <T extends Comparable<T>> void sort(List<T> list) {
sort(list, 0, list.size());
}
private static <T extends Comparable<T>> void sort(List<T> list, int start, int end) {
if (end - start < 2) return;
@janosgyerik
janosgyerik / download-coursera-lecture-notes.bash
Created Oct 8, 2013
Recipe to download all lecture notes of a course on Coursera
View download-coursera-lecture-notes.bash
# requirements: python, virtualenv, pip
#
# create a virtualenv -- I keep all my virtualenvs in ~/virtualenv
virtualenv --distribute ~/virtualenv/coursera
# activate virtualenv
. ~/virtualenv/coursera/bin/activate
# get the coursera downloader tool and install requirements
View test-markdown-gist.md

title

Lorem ipsum dolor sid amet.

section

Lorem ipsum dolor sid amet.

sub-section

View terraform-example.tf
provider "google" {
region = "${var.region}"
project = "${var.project_name}"
credentials = "${file("${var.credentials_file_path}")}"
}
resource "google_compute_instance" "docker" {
count = 1
View terraform-issues.md
google_compute_instance.docker[0]: Creating...
google_compute_instance.docker[0]: Still creating... [10s elapsed]
google_compute_instance.docker[0]: Still creating... [20s elapsed]
google_compute_instance.docker[0]: Provisioning with 'remote-exec'...


Error: Failed to parse ssh private key: ssh: cannot decode encrypted private keys
You can’t perform that action at this time.