Skip to content

Instantly share code, notes, and snippets.

View JacksonBelizario's full-sized avatar
🏠
Working from home

Jackson Belizário JacksonBelizario

🏠
Working from home
View GitHub Profile
@JacksonBelizario
JacksonBelizario / zlib_strings.cpp
Created February 12, 2021 22:19 — forked from gomons/zlib_strings.cpp
Compressing STL Strings with zlib
// Copyright 2007 Timo Bingmann <tb@panthema.net>
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
//
// Original link http://panthema.net/2007/0328-ZLibString.html
#include <string>
#include <stdexcept>
#include <iostream>
#include <iomanip>
@JacksonBelizario
JacksonBelizario / win10colors.cmd
Created November 15, 2020 02:48 — forked from mlocati/win10colors.cmd
ANSI Colors in standard Windows 10 shell
@echo off
setlocal
call :setESC
cls
echo %ESC%[101;93m STYLES %ESC%[0m
echo ^<ESC^>[0m %ESC%[0mReset%ESC%[0m
echo ^<ESC^>[1m %ESC%[1mBold%ESC%[0m
echo ^<ESC^>[4m %ESC%[4mUnderline%ESC%[0m
#include <boost/process.hpp>
#include <iostream>
#include <thread>
namespace bp = boost::process;
using namespace std;
void parent()
{
cout << "[P] Started" << endl;
@JacksonBelizario
JacksonBelizario / fork.c
Created October 14, 2020 16:59 — forked from Cr4sh/fork.c
fork() for Windows
/*
* fork.c
* Experimental fork() on Windows. Requires NT 6 subsystem or
* newer.
*
* Copyright (c) 2012 William Pitcock <nenolod@dereferenced.org>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
@JacksonBelizario
JacksonBelizario / conversion.cpp
Created September 11, 2020 16:15 — forked from pezy/conversion.cpp
Encoding Conversion In C++
// Convert a wide Unicode string to an UTF8 string
std::string utf8_encode(const std::wstring &wstr)
{
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
std::string strTo(size_needed, 0);
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
return strTo;
}
// Convert an UTF8 string to a wide Unicode String
#ifndef _DATE_TIME_FACET__HPP__
#define _DATE_TIME_FACET__HPP__
/* Copyright (c) 2004-2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Martin Andrian, Jeff Garland, Bart Garst
* $Date$
*/
@JacksonBelizario
JacksonBelizario / copyFirestoreDB.js
Created February 25, 2020 23:07 — forked from brunobraga95/copyFirestoreDB.js
Copy firestore database
const firebase = require('firebase-admin');
var serviceAccountSource = require("./source.json"); // source DB key
var serviceAccountDestination = require("./destination.json"); // destiny DB key
const sourceAdmin = firebase.initializeApp({
credential: firebase.credential.cert(serviceAccountSource)
});
const destinyAdmin = firebase.initializeApp({
@JacksonBelizario
JacksonBelizario / paging.js
Created February 15, 2020 17:06 — forked from olmoser/paging.js
Firebase Pagination asc/desc in nodejs/koa
const _ = require('lodash');
module.exports = function(config, log, firebase) {
let module = {};
const db = firebase.database();
module.loadUsers = async(ctx, next) => {
let usersRef = db.ref("/users");
let limit = ctx.query.limit ? parseInt(ctx.query.limit) : 10;
let orderBy = ctx.query.orderBy || 'score';