Skip to content

Instantly share code, notes, and snippets.

View carlosascari's full-sized avatar
:octocat:
Mediatek Hacker

Ascari carlosascari

:octocat:
Mediatek Hacker
  • Home
View GitHub Profile
@carlosascari
carlosascari / livereload.js
Last active November 3, 2018 03:11
A pluggable live reload script. Works w/out a server
/**!
* 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 '$';
@carlosascari
carlosascari / index_of.c
Created February 19, 2019 23:22
Find index of a cstring in a cstring
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)
{
@carlosascari
carlosascari / chungus.sh
Last active July 23, 2020 00:41
Script to find largest files in current directory
#!/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
@carlosascari
carlosascari / gzgitfiles.sh
Created November 19, 2021 23:11
Copies files and their dir structure that are modified into a gzip compressed file
git diff --no-commit-id --name-only | tar -czf modified_files.tgz -T -
@carlosascari
carlosascari / parse_url_search.js
Last active February 2, 2022 23:31
Converts param/search string in url into object
/**
* 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 } })))
@carlosascari
carlosascari / int32.s
Created October 6, 2017 02:36
BIOS Calls in Protected Mode by Napalm
;
; 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.
;