This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts param/search string component from a url into an object | |
* Uses `location.search` as input string | |
*/ | |
Object.assign.apply({}, location.search.substr(1).split('&').map(x => x.split('=').reduce((a, b) => { return { [a]: b } }))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git diff --no-commit-id --name-only | tar -czf modified_files.tgz -T - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Top 20 Files | |
find -type f -exec du -Sh {} + | sort -rh | head -n 20 | |
# Top 20 Dirs | |
du -Sh | sort -rh | head -20 | |
du -a . | sort -n -r | head -n 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int index_of(char* hay, char* needle, size_t start) { | |
size_t len = strlen(hay); | |
size_t needle_len = strlen(needle); | |
int subfind = 0; | |
for (int j = start; j < len; ++j) | |
{ | |
if (hay[j] == needle[0]) { | |
subfind = 1; | |
for (int k = 1; k < needle_len; ++k) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**! | |
* A pluggable live reload script. No server required. | |
* Will reload page whenever the page content or link & script | |
* resources change. | |
* A reload will only be triggered when the page/window has focus. | |
*/ | |
// https://gist.github.com/carlosascari/cc85e74544e4a26dcd88e94eb7a281ea | |
import $ from '$'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* jQuery selector substitute | |
* A quick one-liner for a jQuery-like selector, when a project | |
* does not need the extra weight early on, but may need jQuery later on. | |
* @param {String} query - CSS selector | |
* @param {HTMLElement} context - Element to query, defaults to `document` | |
* @return {Array<Element>} | |
*/ | |
$ = (query, context=document) => Array.prototype.slice.call(context.querySelectorAll(query)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- OpenStreetMap database schema for api 0.6 | |
-- | |
PRAGMA synchronous = OFF; | |
PRAGMA journal_mode = MEMORY; | |
BEGIN TRANSACTION; | |
CREATE TABLE acls( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright(c) 2017 Carlos Ascari Gutierrez Hermosillo. | |
* MIT License. | |
*/ | |
// Based on normalize.css 7.0.0 | |
// https://github.com/necolas/normalize.css/tree/7.0.0 | |
// + This version allows removing IE support by version as well as | |
// as hiding rarely used tags. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
; Protected Mode BIOS Call Functionailty v2.0 - by Napalm | |
; ------------------------------------------------------- | |
; | |
; This is code shows how its POSSIBLE to execute BIOS interrupts | |
; by switch out to real-mode and then back into protected mode. | |
; | |
; If you wish to use all or part of this code you must agree | |
; to the license at the following URL. | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {SVGSVGElement} svg | |
* @param {Number} [w] Width of png image. Default: 128 | |
* @param {Number} [h] Height of png image. Default: 128 | |
* @return {Image} png image | |
*/ | |
const svg2png = (svg, w=128, h=128) => { | |
svg.setAttribute('width', `${w}px`); | |
svg.setAttribute('height', `${h}px`); | |
const xml = new XMLSerializer().serializeToString(svg); |
NewerOlder