Skip to content

Instantly share code, notes, and snippets.

View mbilyanov's full-sized avatar

Milen Bilyanov mbilyanov

View GitHub Profile
@mbilyanov
mbilyanov / prog.c
Last active May 29, 2022 22:24
realloc() working
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char* word_generator(int selector)
{
switch(selector)
{
case 0:
return "gpu-log-02_05_2022_12_37_56_784";
@mbilyanov
mbilyanov / toolchain-mingw32.cmake
Created September 22, 2020 09:15
toolchain-mingw32.cmake
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)
# Choose an appropriate compiler prefix
# /include and /lib folders required by the 64bit mingw.
set(COMPILER_PREFIX "x86_64-w64-mingw32")
# which compilers to use for C and C++
find_program(CMAKE_C_COMPILER NAMES /usr/bin/${COMPILER_PREFIX}-gcc)
@mbilyanov
mbilyanov / make_output_01
Created September 21, 2020 21:03
make_output_01
/usr/bin/cmake -S/home/mbilyanov/dev/SC_DEV/MySCStudy -B/home/mbilyanov/dev/SC_DEV/MySCStudy/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/mbilyanov/dev/SC_DEV/MySCStudy/build/CMakeFiles /home/mbilyanov/dev/SC_DEV/MySCStudy/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/mbilyanov/dev/SC_DEV/MySCStudy/build'
make -f CMakeFiles/MySCStudy.dir/build.make CMakeFiles/MySCStudy.dir/depend
make[2]: Entering directory '/home/mbilyanov/dev/SC_DEV/MySCStudy/build'
cd /home/mbilyanov/dev/SC_DEV/MySCStudy/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mbilyanov/dev/SC_DEV/MySCStudy /home/mbilyanov/dev/SC_DEV/MySCStudy /home/mbilyanov/dev/SC_DEV/MySCStudy/build /home/mbilyanov/dev/SC_DEV/MySCStudy/build /home/mbilyanov/dev/SC_DEV/MySCStudy/build/CMakeFiles/MySCStudy.dir/DependInfo.cmake --color=
Dependee "/home/mbilyanov/dev/SC_DEV/MySCStudy/build/CMakeFiles/MySCStudy.dir/DependInfo.cmake" is newer th
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
@mbilyanov
mbilyanov / asyncEventEmitterSolved.js
Created July 12, 2020 22:24
Solution for the async event emitter.
var events = require('events');
var em = new events.EventEmitter();
const sleep = (ms, message) => {
return new Promise(function(resolve, reject) {
setTimeout(function() {
// console.log('[DELAYED_PROCESS] completed.');
resolve(message);
}, ms);
});
@mbilyanov
mbilyanov / asyncEventEmitter.js
Created July 12, 2020 20:50
Attempting to figure out how to write this eventEmitter handler with the async syntax.
// NOT WORKING :(
async function queueSignalHandler() {
eventEmitter.once('consume', async function() {
// Start consuming the queue.
console.log('consuming ...');
let response;
try{
response = await assetRequester.processQueue()
console.log('=== RESOLVED ===\n', response, '\n================');
return response;
sleep(1000)
.then((message) => {
console.log('Submittin to group [15m]');
asset_list
.forEach((n) => {
assetRequester.submit(n, '15m', {maxRetries: 2});
})
})
.catch((err) => {
console.log(`CRITICAL_FAILURE: Submission failed for group [15M].\n${err}`);
(async () => {
try{
let response = await assetRequester.processQueue();
console.log(JSON.stringify(response));
}catch(e){
console.log(`CRITICAL_FAILURE: ${e}`);
};
})();
try {
console.log('Submittin to group [5m]');
asset_list
.forEach((n) => {
assetRequester.submit(n, '5m', {maxRetries: 1});
});
}catch(e){
console.log('CRITICAL_FAILURE: Submission failed for group [5m].');
}
try {
console.log('Submittin to group [5m]');
asset_list
.forEach((n) => {
assetRequester.submit(n, '5m', {maxRetries: 1});
});
}catch(e){
console.log('CRITICAL_FAILURE: Submission failed for group [5m].');
}