Skip to content

Instantly share code, notes, and snippets.

Rudie Dirkx rudiedirkx

Block or report user

Report or block rudiedirkx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View laravel.txt
ClientController (page callback)
- Annotations
- @Get/@Post - URI
- @Middleware - auth
- AuthServiceProvider - auth definition
- UserPolicy - auth callbacks
User model (entity type)
- Shared logic
- Authenticable
View keepalive.sh
script=$1
echo $script
while [ true ]; do
DT=$(date +"%Y%m%d_%H%M%S")
FILE="/tmp/keepalive-$DT.log"
echo $FILE
echo
touch $FILE
View ethrly-server.js
// console.log(process.argv);
var port = parseInt(process.argv[2]);
if ( !port || isNaN(port) ) {
console.log('\nPort arg must be int.\n\n');
process.exit();
}
var status = [0, 0, 0, 0, 0, 0, 0, 0];
View mailtodisk.php
<?php
// sendmail_path="C:\XAMPP\php\php.exe C:\WWW\mailtodisk.php \"C:\XAMPP\mailoutput\__TIME__-__RAND__-__SUBJECT__.eml\""
// sendmail_path = "/usr/bin/php /var/www/mailtodisk.php \"/var/www/mailoutput/__TIME__-__RAND__-__SUBJECT__.eml\""
// file_put_contents(__DIR__ . '/mailtodisk.log', print_r($_SERVER, 1));
// Destination folder/filename is required
$destination = @$_SERVER['argv'][1];
if (!$destination) {
View ted-downloader.bookmarklet.js
javascript:
([].forEach.call(document.scripts, function(el, p) {
var code = el.innerHTML.trim();
if ( (p = code.indexOf('q("talkPage.init",')) > -1 ) {
var json = code.slice(p + 18, -1).trim();
var talk = JSON.parse(json).talks[0];
var url = talk.nativeDownloads.high || talk.nativeDownloads.medium;
var a = document.createElement('a');
a.href = url;
a.download = url.match(/([^\/\?]+)(\?.+?)?$/)[1];
@rudiedirkx
rudiedirkx / node-socket-listener.js
Created Nov 15, 2015
Super simple socket listener in Node
View node-socket-listener.js
var net = require('net');
function log(msg) {
process.stdout.write(msg.trim() + "\n", 'utf8');
}
var port = Number(process.argv[2]);
if ( !port || isNaN(port) ) {
return log('Need valid PORT number as argument.');
}
View firebase.log
curl -X PUT -d '"Jeff"' https://cr2jl3cpyv7.firebaseio.com/users/jeff/name.json
curl -X PUT -d '"Carla"' https://cr2jl3cpyv7.firebaseio.com/users/carla/name.json
curl -X PATCH -d '{"jeff/city": "Houston", "carla/city": "Atlantis"}' https://cr2jl3cpyv7.firebaseio.com/users.json
curl -X PATCH -d '{"jeff/family": {"children": 1, "parents": 0, "siblings": 1}, "carla/family": {"children": 4, "parents": 2, "siblings": 3}}' https://cr2jl3cpyv7.firebaseio.com/users.json
curl -X PATCH -d '{"jeff/family/children": 2, "carla/family/parents": 0}' https://cr2jl3cpyv7.firebaseio.com/users.json
{
"carla":{"city":"Atlantis","family":{"children":4,"parents":0,"siblings":3},"name":"Carla"},
"jeff":{"city":"Houston","family":{"children":2,"parents":0,"siblings":1},"name":"Jeff"}
}
View tegenlicht-downloader.bookmarklet.js
javascript:
performance.setResourceTimingBufferSize(5000);
performance.getEntriesByType('resource').some(function(res) {
if (res.name.slice(-5) == '-1.ts') {
console.log(res.name);
return prompt('COPY THIS URL', res.name), true;
}
});
void(0);
View array-query-builder.php
<?php
// SELECT a.*, c.d, (c.e = 'foo') AS ee, c.f AS ff
// FROM table1 a, table3 m
// LEFT JOIN table2 b ON a.x = c.x AND a.x <> '4'
// WHERE m.x = a.x AND a.y < 100 AND (a.z BETWEEN 1 AND 9 OR a.z = -1)
// GROUP BY (c.e = 'foo'), c.f
// HAVING MAX(m.n) > 2
// ORDER BY c.e DESC
// LIMIT 100
View resource-domains.bookmarklet.js
javascript:
alert((function(list) {
console.log(list);
var arr = [];
for (var host in list) arr.push(host + ': ' + list[host]);
arr.sort(function(a, b) { return parseInt(b.split(': ')[1]) - parseInt(a.split(': ')[1]); });
return arr;
})(performance.getEntriesByType('resource').reduce(function(list, res) {
var host = res.name.match(/\/\/([^/]+)/)[1];
list[host] ? (list[host]++) : (list[host] = 1);
You can’t perform that action at this time.