Skip to content

Instantly share code, notes, and snippets.

View n1k0's full-sized avatar
✏️
writing a github status

Nicolas Perriault n1k0

✏️
writing a github status
View GitHub Profile
@n1k0
n1k0 / gist:1501173
Created December 20, 2011 10:44 — forked from fbuchinger/gist:1501115
PhantomJS: Capturing single dom elements as png files
var page = new WebPage(),
address, output, size;
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs
capture = function(targetFile, clipRect) {
var previousClipRect;
var clipRect = {top: 0, left:0, width: 40, height: 40};
if (clipRect) {
if (!isType(clipRect, "object")) {
throw new Error("clipRect must be an Object instance.");
@n1k0
n1k0 / unblur.md
Last active December 19, 2023 13:50
Unblur bookmarlklet

Unblur bookmarklet

Too many websites rely on the CSS blur filter to cheaply obfuscate contents. Here's a bookmarklet to reset all active blur styles from the current page DOM.

(function() {
  for (const x of document.querySelectorAll("*")) {
    const s = getComputedStyle(x);
    for (const k in s) {
 if (k.includes("filter") && s.filter.includes("blur")) {
@n1k0
n1k0 / Basic synthesis
Created February 14, 2012 13:07
Olympus OM-D EM-5 sample pictures exif data
======== ./2012020819033471175.jpeg
ISO : 200
Aperture : 6.3
Lens Model : OLYMPUS M.12-50mm F3.5-6.3
Focal Length : 12.0 mm
Shutter Speed : 1/4000
======== ./2012020819052527425.jpeg
ISO : 1600
Aperture : 4.5
Lens Model :
@n1k0
n1k0 / Howto.md
Created October 1, 2012 17:59
CasperJS test cli hooks example

Put test1.js and test2.js into a tests/ directory, then run the suite:

$ casperjs test tests/ --pre=pre.js --includes=inc.js --post=post.js
Test file: /Users/nperriault/tmp/pre-inc/pre.js                                 
Hey, I'm executed before the suite.
Test file: /Users/nperriault/tmp/pre-inc/tests/test1.js                         
# this is test 1
Hi, I've been included.
PASS Subject is strictly true
@n1k0
n1k0 / log.xml
Created December 18, 2012 21:49
Sample JUnit XML (XUnit) test report logs for CasperJS test suite. See https://github.com/n1k0/casperjs/pull/329
<?xml version="1.0" encoding="UTF-8"?>
<testsuites duration="50.5">
<testsuite failures="0" name="Untitled suite in /Users/niko/Sites/casperjs/tests/suites/casper/agent.js" package="tests/suites/casper/agent" tests="3" time="0.256">
<testcase classname="tests/suites/casper/agent" name="Default user agent matches /CasperJS/" time="0.103"/>
<testcase classname="tests/suites/casper/agent" name="Default user agent matches /plop/" time="0.146"/>
<testcase classname="tests/suites/casper/agent" name="Default user agent matches /plop/" time="0.007"/>
</testsuite>
<testsuite failures="0" name="Untitled suite in /Users/niko/Sites/casperjs/tests/suites/casper/alert.js" package="tests/suites/casper/alert" tests="1" time="0.449">
<testcase classname="tests/suites/casper/alert" name="alert event has been intercepted" time="0.449"/>
</testsuite>
@n1k0
n1k0 / fallback.py
Created June 28, 2012 15:30
Attribute fallback in Python - useful when you cannot extend an existing class, or want a proxy
class Bar(object):
def plop(self):
print 'plop'
class Foo(object):
def __init__(self):
self.bar = Bar()
def do(self):
print 'done'
@n1k0
n1k0 / shush-blocklist.txt
Last active December 3, 2020 14:39 — forked from adriantombu/shush-covid19.txt
A personal blocklist to be used with Shush! browser extension https://github.com/adriantombu/shush
patriote,
patriotes,
identitaire,
identitiares

Keybase proof

I hereby claim:

  • I am n1k0 on github.
  • I am n1k0 (https://keybase.io/n1k0) on keybase.
  • I have a public key ASBAtEJcRmxSj6XhdF7cyySIwHNXU--pLHpr6bkdytaQtAo

To claim this, I am signing this object:

@n1k0
n1k0 / fields.py
Created March 12, 2020 17:57 — forked from danni/fields.py
Multi Choice Django Array Field
from django import forms
from django.contrib.postgres.fields import ArrayField
class ChoiceArrayField(ArrayField):
"""
A field that allows us to store an array of choices.
Uses Django 1.9's postgres ArrayField
and a MultipleChoiceField for its formfield.
@n1k0
n1k0 / casper-google-suggest.md
Last active February 22, 2020 17:50
A simple CasperJS script to fetch google suggestions from a partial search

CasperJS Google Suggest

The script:

/*global casper:true*/
var casper = require('casper').create({
    pageSettings: {
        userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Firefox/31.0"
 }