Skip to content

Instantly share code, notes, and snippets.

Avatar
✏️
writing a github status

Nicolas Perriault n1k0

✏️
writing a github status
View GitHub Profile
@n1k0
n1k0 / fallback.py
Created Jun 28, 2012
Attribute fallback in Python - useful when you cannot extend an existing class, or want a proxy
View fallback.py
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 Dec 3, 2020 — forked from adriantombu/shush-covid19.txt
A personal blocklist to be used with Shush! browser extension https://github.com/adriantombu/shush
View shush-blocklist.txt
patriote,
patriotes,
identitaire,
identitiares
View keybase.md

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 / unblur.md
Last active Oct 22, 2020
Unblur bookmarlklet
View unblur.md

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 / fields.py
Created Mar 12, 2020 — forked from danni/fields.py
Multi Choice Django Array Field
View fields.py
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 / log.xml
Created Dec 18, 2012
Sample JUnit XML (XUnit) test report logs for CasperJS test suite. See https://github.com/n1k0/casperjs/pull/329
View log.xml
<?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 / casper-google-suggest.md
Last active Feb 22, 2020
A simple CasperJS script to fetch google suggestions from a partial search
View casper-google-suggest.md

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"
    }
@n1k0
n1k0 / 404checker.js
Created Jan 11, 2013
A CasperJS script to check for 404 & 500 internal links on a given website
View 404checker.js
/**
* This casper scipt checks for 404 internal links for a given root url.
*
* Usage:
*
* $ casperjs 404checker.js http://mysite.tld/
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42
*/
/*global URI*/
@n1k0
n1k0 / pre-commit
Created Jul 7, 2015
This git pre-commit hook checks for .only remaining in js mocha test files and prevent commiting if any.
View pre-commit
#!/bin/sh
# This checks for .only remaining in js mocha test files and prevent
# commiting if any.
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
@n1k0
n1k0 / gist:1501173
Created Dec 20, 2011 — forked from fbuchinger/gist:1501115
PhantomJS: Capturing single dom elements as png files
View gist:1501173
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.");
You can’t perform that action at this time.