Skip to content

Instantly share code, notes, and snippets.

@Snyder
Snyder / fileToImage.py
Created November 6, 2013 18:14
Convert a file into it's image representation, it only takes the raw byte stream and make it pixels and then makes an image.
#!/usr/bin/env python
import Image
from math import sqrt
import sys
def creaImg(entrada, salida):
with open(entrada, 'r') as f:
datos = f.read()
bytes_datos = bytearray(datos)
pixeles = []
@koelling
koelling / gist:ef9b2b9d0be6d6dbab63
Last active February 7, 2017 16:21
CVE-2015-0235 (GHOST) test code
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define CANARY "in_the_coal_mine"
struct {
char buffer[1024];
@ko-zu
ko-zu / iptcheck.py
Last active November 16, 2018 02:07
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 ko-zu <causeless@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@corsonx
corsonx / upload_via_iframe
Created January 10, 2014 14:48
Posting a form via AJAX through a hidden iFrame. This is necessary when uploading an image using ajax for IE < 10. It is also useful in other cases, where your post endpoint cannot easily digest JSON, for instance.
// This particular code works with html that looks like this:
<div class="upload_container" id="photo_number_1">
<div><input name="upload" class="photo_upload_field" type="file" /></div>
<div><input type="button" class="upload_photo_submit" value="Upload Photo"></div>
<p class="center loading hidden"><img src="/assets/loading.gif"></p>
<script>
// yes, I know, don't actually put this in a script tag here. It's for illustration purposes only
$('.upload_photo_submit')[0]).click(function(event){ajaxFileUpload(event);});
</script>
# The following solution is used to enable GCLB with 1.0.x istio-on-gke add on.
#
# Ingress gateway in gke-add-on cannot be modified because it is reconciled.
#
# 1. Create a new ilgateway deployment with `--statusPort 15020`.
# 2. Create a new service of type 'NodePort` to point to the above deployment
# 3. In the target namespace, create a `gateway` resource to point to the ilbgateway by using
# `selector: { "istio": "ilgateway" }
# 4. Point k8s (GCLB) ingress resource to ilgateway
# 5. Add advanced health-check for GCLB
@abeppu
abeppu / feelbetter.js
Last active February 6, 2021 19:06
Implementation of @FeelBetterBot
var Twit = require("twit");
var config = require('./oauthconfig');
console.log("config:");
console.log(config);
var T = new Twit({
consumer_key: config.consumer_key,
consumer_secret: config.consumer_secret,
access_token: config.access_token,
@uakfdotb
uakfdotb / protect
Last active September 13, 2021 01:38
<?php
// https://lunanode.com/
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
@yoav-steinberg
yoav-steinberg / rediff.py
Created April 13, 2014 15:48
rediff - the redis diff script
import urlparse
import argparse
import redis
import sys
from multiprocessing import Pool
import signal
def parse_redis_url(s):
url = urlparse.urlparse(s)
if not url.scheme: