Skip to content

Instantly share code, notes, and snippets.

@samuraisam
samuraisam / deep_eq.py
Last active October 10, 2024 15:52
Deep Equality Test for Nested Python Structures
#Copyright (c) 2010-2013 Samuel Sutch [[email protected]]
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in
@schlamar
schlamar / processify.py
Last active October 9, 2024 12:18
processify
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
def processify(func):
'''Decorator to run a function as a process.
Be sure that every argument and the return value
@postmodern
postmodern / Makefile
Last active March 4, 2024 14:42
A generic Makefile for building/signing/install bash scripts
NAME=project
VERSION=0.0.1
DIRS=etc lib bin sbin share
INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null`
INSTALL_FILES=`find $(DIRS) -type f 2>/dev/null`
DOC_FILES=*.md *.txt
PKG_DIR=pkg
PKG_NAME=$(NAME)-$(VERSION)
@KrofDrakula
KrofDrakula / index.md
Created September 5, 2012 16:53
WebKit image rendering performance

Rendering performance on WebKit

Please send any feedback on this article to Klemen Slavič

UPDATE: I'm currently in the process of updating the article, as my assumptions about the inner workings of WebKit are incorrect. I will update this article with the relevant facts and provide concrete information in place of my guesstimates below.

I've recently stumbled upon an interesting discovery regarding image rendering performance in most WebKit browsers. Namely, I've been developing a sprite animation component to implement a GIF animation replacement with better compression and performance, where I noticed that some animations appeared to be janky when using multi-frame spritesheets and clipping rectangles. Here's what I found out.

But first, a quick rundown of the basic functioning of the WebKit engine as I understand it.

@jmaupetit
jmaupetit / ghost_capture_pdf.py
Created December 5, 2012 17:57
Ghost.py capture to PDF
from ghost import Ghost
from PySide.QtGui import QApplication, QImage, QPainter, QPrinter
class MyGhost(Ghost):
def capture_pdf(self):
printer = QPrinter(QPrinter.HighResolution)
printer.setResolution(300)
printer.setOutputFileName("QtPrinter.pdf")
printer.setPaperSize(QPrinter.A4)
@latagore
latagore / ipv6-regex-test.sh
Last active June 29, 2016 23:18 — forked from syzdek/ipv6-regex-test.sh
Test IPv6 regular expression without dependency on custom scripts
#!/bin/sh
#
test_regex () {
REGEX="$1";
TEST_STRINGS="$2";
[ -n "$3" ] && [ "$3" = "expect_no_match" ] && SHOW_NON_MATCHING="-v";
# find IP addresses anywhere in the string
# but avoid certain characters in the beginning and end
@stuaxo
stuaxo / processify.py
Last active July 12, 2024 08:32 — forked from schlamar/processify.py
processify
# modified from https://gist.github.com/schlamar/2311116#file-processify-py-L17
# also see http://stackoverflow.com/questions/2046603/is-it-possible-to-run-function-in-a-subprocess-without-threading-or-writing-a-se
import inspect
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
@Arinerron
Arinerron / root.sh
Last active June 10, 2024 17:35
"Root" via dirtyc0w privilege escalation exploit (automation script) / Android (32 bit)
#!/bin/bash
# Give the usual warning.
clear;
echo "[INFO] Automated Android root script started.\n\n[WARN] Exploit requires sdk module \"NDK\".\nFor more information, visit the installation guide @ https://goo.gl/E2nmLF\n[INFO] Press Ctrl+C to stop the script if you need to install the NDK module. Waiting 10 seconds...";
sleep 10;
clear;
# Download and extract exploit files.
echo "[INFO] Downloading exploit files from GitHub...";
@ityonemo
ityonemo / primefield.jl
Created May 29, 2017 02:21
trivial and possibly inefficient prime field implementation
#primefield.jl
type PrimeField{P}
intval::UInt64
function PrimeField(n)
new(n % P)
end
end
Base.:+{P}(x::PrimeField{P}, y::PrimeField{P}) = PrimeField{P}(x.intval + y.intval)