Skip to content

Instantly share code, notes, and snippets.

$ curl --insecure -H "Host: http://github.com " -v https://github.com .A520FF6C4690D131A96967BEDD740751FB33A230.exit/
* About to connect() to proxy 127.0.0.1 port 8118 (#0)
* Trying 127.0.0.1...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8118 (#0)
* Establish HTTP proxy tunnel to github.com.A520FF6C4690D131A96967BEDD740751FB33A230.exit:443
> CONNECT github.com.A520FF6C4690D131A96967BEDD740751FB33A230.exit:443 HTTP/1.1
> User-Agent: curl/7.26.0
@jedisct1
jedisct1 / pureftpd shellshock.txt
Last active August 8, 2023 20:07
Pure-FTPd + external authentication handler #shellshock POC
$ cat > /tmp/handler.sh
#! /bin/bash
echo auth_ok:1
echo uid:42
echo gid:21
echo dir:/tmp
echo end
^D
$ chmod +x /tmp/handler.sh
@morhekil
morhekil / nginx.conf
Created August 14, 2014 12:18
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
@jimbocoder
jimbocoder / 14.04-bloat-packages
Created August 10, 2014 20:30
Ubuntu 14.04 Desktop bloat removal package list
# Purge the following packages
account-plugin-aim
account-plugin-facebook
account-plugin-flickr
account-plugin-jabber
account-plugin-salut
account-plugin-twitter
account-plugin-windows-live
account-plugin-yahoo
anonymous
anonymous / gist:9924932
Created April 1, 2014 23:08
%% Read image and convert to grayscale
img = imread('pic.jpg');
img = rgb2gray(img);
%% Define grayscale representations of 0-255
chars = fliplr([' ', '.', ',', ':', '-', '=', '+', '*', '#', '%', '@']);
step = 256 / 11;
%% Cut image so its size is 8*w times 13*h
imgSize = size(img);
@aslakknutsen
aslakknutsen / start_testing_java8_today.asciidoc
Last active October 11, 2023 20:07
Example of how to use both JDK 7 and JDK 8 in one build.

JDK 8 Released

Most of us won’t be able to use/deploy JDK 8 in production for a looong time. But that shouldn’t stop us from using it, right?

It should be possible to sneak in JDK 8 in the back way, the same way we snuck in Groovy and other libraries we wanted to use.

The Test Suite to the rescue

The Maven compiler plugin run in two separate lifecycles, compile and testCompile. Those can be configured separately.

@raphw
raphw / UnsafeTest.java
Last active January 10, 2023 20:12
A demonstration of sun.misc.Unsafe
import org.junit.Before;
import org.junit.Test;
import sun.misc.Unsafe;
import sun.reflect.ReflectionFactory;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import static org.junit.Assert.assertEquals;
@pepperbob
pepperbob / rdfbean-2-#56
Last active December 26, 2015 17:29
"Streaming approach": RDFHandler for Rio will flush the cached STMTs if a (currently hard coded) limit is reached.
diff --git a/rdfbean-virtuoso/pom.xml b/rdfbean-virtuoso/pom.xml
index b410b7d..5ad612e 100644
--- a/rdfbean-virtuoso/pom.xml
+++ b/rdfbean-virtuoso/pom.xml
@@ -23,6 +23,11 @@
<artifactId>rdfbean-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.mysema.rdf</groupId>

Overview

In general, it seems there are roughly five (5) ways to get "file data" (e.g. a GeoTIFF) out of a PostGIS geoprocessing workflow:

  • Export just the raster field as an ASCII grid
  • Connect to the database using a desktop client (e.g. QGIS) [1]
  • Use a procedural language (like PLPGSQL or PLPYthon) [2]
  • Use the COPY declaration to get a hex dump out and convert it to a binary file
  • Fill a 2D NumPy array with a byte array and serialize it to a binary file using GDAL or psycopg2 [3, 4]
  • Use ST_AsTiff() or the more general ST_AsGDALRaster() to get a byte array, which can be written to a binary file
@wacko
wacko / gist:5577187
Last active January 6, 2024 07:31
SSH between Mac OS X host and Virtual Box guest

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0