Skip to content

Instantly share code, notes, and snippets.

View nullxx's full-sized avatar
💪
assembly rules

NULLX nullxx

💪
assembly rules
View GitHub Profile
@nullxx
nullxx / pubsub.c
Last active March 23, 2022 18:54
Pub-sub simple implementation in c. Notification events are triggered sequentially :(
//
// pubsub.c
// mpp-cpu
//
// Created by https://github.com/nullxx on 22/3/22.
//
#include "pubsub.h"
#include <stdio.h>
@nullxx
nullxx / scheduler.js
Created March 5, 2022 10:33
in-memmory js funcion scheduler. Execute a promise function at a time. Very usable when receiving multiple events and want to process them one by one in order
const queue = [];
async function schedule(func) {
if (queue.length !== 0) return queue.push(func); // if another task is scheduled, push this task to the queue
queue.push(func);
do {
await queue[0]();
queue.shift();
} while (queue.length > 0);
@nullxx
nullxx / reversePaginate.js
Created February 23, 2022 08:09
Paginate reverse order
const requestedPage = 5;
const page = Math.max(1, requestedPage + 1);
console.log('Requested page', page);
const totalNotis = 20;
const paginate = 3;
const skip = Math.max(0, totalNotis - page * paginate);
@nullxx
nullxx / README.MD
Last active April 22, 2021 07:32
Download google doc document
  • Execute Bookmark "open IFRAME google doc"
  • Inside that new window execute bookmark "extract slides google doc"
<script>var s="=iunm?  =ifbe? !!!!=nfub!dibstfu>#VUG.9#? !!!!=nfub!obnf>#wjfxqpsu#!dpoufou>#xjeui>efwjdf.xjeui-!jojujbm.tdbmf>2/1-!nbyjnvn.tdbmf>2/1-!vtfs.tdbmbcmf>op#!0? !!!!=tuzmf? !!!!!!!!/dfoufsIpsj{poubm!| !!!!!!!!!!!!ufyu.bmjho;!dfoufs< !!!!!!!!!!!!0+!qbeejoh;!1!211qy!1!211qy<!+0 !!!!!!!!~  !!!!!!!!q!| !!!!!!!!!!!!gpou.gbnjmz;!(Dpvsjfs!Ofx(-!Dpvsjfs-!npoptqbdf< !!!!!!!!~  !!!!!!!!/mbcfm!| !!!!!!!!!!!!0+!ufyu.bmjho;!mfgu<!+0 !!!!!!!!!!!!gpou.tj{f;!24qy< !!!!!!!!~  !!!!!!!!$tfmfduJojuXffl- !!!!!!!!$zfbsDpvstfTfmfdu!| !!!!!!!!!!!!xjeui;!411qy< !!!!!!!!~  !!!!!!!!$epxompbeCuo!| !!!!!!!!!!!!nbshjo.upq;!21qy< !!!!!!!!~ !!!!=0tuzmf? =0ifbe?  =cpez?  !!!!=ejw!dmbtt>#dfoufsIpsj{poubm#? !!!!!!!!=i2?Ipsbsjpt!VQW=0i2? !!!!!!!!=q?Ftub!qbhjob!xfc!fyqpsub!uv!ipsbsjp!ef!mb!tfnbob!b!uv!fmfddj\'pbdvufo!fo!vo!gpsnbup!rvf!tpmp!mp !!!!!!!!!!!!mff!mb!tjhvjfouf!=b!isfg>#iuuqt;00dmbttujnfubcmf/bqq0#?bqmjdbdj\'pbdvufo=0b?=0q? !!!!!!!!=gjfmetfu? !!!!!!!!!!!!=mfhfoe?Gpsnvmbsjp=0mfhfoe? !!!!!
@nullxx
nullxx / macPackager.sh
Created April 11, 2020 14:03
./macPackager.sh <JAVA_HOME> <APP_NAME> <MAIN_APP_CLASS> <APP_VERSION> <ICON_NAME> <JAR_EXECUTABLE_INPUT>
#!/bin/bash
JAVA_HOME=$1
APP_NAME=$2
MAIN_APP_CLASS=$3
APP_VERSION=$4
ICON_NAME=$5
JAR_EXECUTABLE_INPUT=$6
OUT_EXECUTABLE_TYPE=pkg
OUT_FOLDER=out
@nullxx
nullxx / electricPower.py
Created March 23, 2020 08:51
Detectar cuando la corriente se desconecta y conecta para macOS. Se envía una alerta cuando se cambia el estado.
import subprocess
ut = subprocess.check_output(['pmset', '-g', 'batt'])
down = """""
display dialog "LA CORRIENTE HA SIDO CORTADA\nMAS INFORMACION EN CONSOLA " ¬
with title "Alerta corriente alterna general" ¬
with icon caution ¬
buttons {"OK"}
"""