Skip to content

Instantly share code, notes, and snippets.

View blackout314's full-sized avatar
🛸
fly away

Carlo Denaro blackout314

🛸
fly away
View GitHub Profile
@blackout314
blackout314 / crush.js
Created July 25, 2016 08:10 — forked from mbuff24/crush.js
Naive javascript solution for Algorithmic Crush -- https://www.hackerrank.com/contests/w4/challenges/crush
String.prototype.splitSpacesAsInts = function() {
return this.split(" ").map(function(aNum) { return parseInt(aNum); });
};
function processData(input) {
var lines = input.split("\n");
var first = lines[0].splitSpacesAsInts();
var n = first[0];
var m = first[1];
var ops = lines.slice(1).map(function(line) { return line.splitSpacesAsInts(); });
@blackout314
blackout314 / check.php
Created November 27, 2016 13:28
BitMixer Posts Count and EUR calculator
<?php
function extractValue($html) {
$v = explode('New posts:</td><td>',$html);
return explode('</td>', $v[1])[0];
}
function takeBtcTicker() {
$url = 'https://www.bitstamp.net/api/ticker/';
$url = 'https://blockchain.info/ticker';
@blackout314
blackout314 / ComposerPHPUnit.md
Created February 23, 2017 21:06 — forked from GaryRogers/ComposerPHPUnit.md
Getting Composer and PHPUnit to autoload namespaces

Getting Composer and PHPUnit to autoload namespaces.

Overview

Details

Project Structure

ProjectRoot
 src
### Keybase proof
I hereby claim:
* I am blackout314 on github.
* I am blackout314 (https://keybase.io/blackout314) on keybase.
* I have a public key whose fingerprint is CD83 4AB5 136A 97D3 C881 88F1 36A1 91AF 333F CF98
To claim this, I am signing this object:
@blackout314
blackout314 / HowToOTG.md
Created March 17, 2017 11:08 — forked from gbaman/HowToOTG.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@blackout314
blackout314 / browsersync-webpack.md
Created May 5, 2017 08:59 — forked from robinrendle/browsersync-webpack.md
Getting set up with Browsersync and Webpack

Fixing our local environment with Browsersync

Whenever we change our templates we still have to use our build script and this can get annoying. Thankfully with webpack-dev-server and BrowserSync we can fix this:

npm i -D browser-sync browser-sync-webpack-plugin webpack-dev-server

BrowserSync will act like a proxy, waiting for webpack to do its thing and then reloading the browser for us.

@blackout314
blackout314 / 1_phpunit-api.md
Created June 1, 2017 14:00 — forked from loonies/1_phpunit-api.md
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()
@blackout314
blackout314 / cspheader.php
Created July 9, 2017 17:36 — forked from phpdave/cspheader.php
CSP Header for PHP or Apache or .htaccess - Content Security Protocol
<?
//CSP only works in modern browsers Chrome 25+, Firefox 23+, Safari 7+
$headerCSP = "Content-Security-Policy:".
"connect-src 'self' ;". // XMLHttpRequest (AJAX request), WebSocket or EventSource.
"default-src 'self';". // Default policy for loading html elements
"frame-ancestors 'self' ;". //allow parent framing - this one blocks click jacking and ui redress
"frame-src 'none';". // vaid sources for frames
"media-src 'self' *.example.com;". // vaid sources for media (audio and video html tags src)
"object-src 'none'; ". // valid object embed and applet tags src
"report-uri https://example.com/violationReportForCSP.php;". //A URL that will get raw json data in post that lets you know what was violated and blocked
@blackout314
blackout314 / La Coscienza di un Hacker
Created July 25, 2017 19:47 — forked from FiloSottile/La Coscienza di un Hacker
Traduzione in italiano dell'Hacker Manifesto
Questa è una traduzione in italiano del celebre Hacker Manifesto. Tutte quelle
esistenti contengono grossolani errori, perlopiù dovuti ad una carente
comprensione della materia e del periodo, o in ogni caso sono poco fedeli al
contenuto e allo spirito dell'originale. Mi auguro che questa mia traduzione non
soffra degli stessi problemi. Sail strong.
-- FiloSottile
****
Da: Phrack, Volume Uno, Issue 7, Phile 3 of 10
0x85c0E1fee58FE199d8a1CF8D3f8A7c20505E8F40