Skip to content

Instantly share code, notes, and snippets.

@micjabbour
micjabbour / install-ycm-termux.md
Last active March 25, 2024 05:18
How to install YouCompleteMe on Termux

How to install YouCompleteMe on Termux

Problem

As of March 2021, YouCompleteMe compiles fine on Termux, but it crashes once the plugin is loaded. The following error can be noticed in the logs:

ImportError: dlopen failed: cannot locate symbol "_ZNSt6__ndk14__fs10filesystem18__weakly_canonicalERKNS1_4pathEPNS_10error_codeE" referenced by "/data/data/com.termux/files/home/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so"...
@micjabbour
micjabbour / cred_read.py
Created August 8, 2020 12:40
A Python script to dump all stored credentials from Windows Credential Manager into standard output.
"""
A Python script to dump all stored credentials from Windows Credential Manager into standard
output. It uses ctypes to interface with functions from Win32 Security and Identity API in order to
retrieve credentials for the current user.
Start using:
python cred_read.py
"""
import ctypes
@micjabbour
micjabbour / CMakeLists.txt
Last active March 21, 2021 09:29
Suppress Windows Error Reporting crash dialogs
cmake_minimum_required(VERSION 3.2)
project(suppress_wer)
option(USE_DEBUGGER_BASED_SOLUTION "Uses a debugger-based solution instead of SetErrorMode. See suppress_wer_debugger.cpp for details" OFF)
if(USE_DEBUGGER_BASED_SOLUTION)
add_executable(suppress_wer suppress_wer_debugger.cpp)
else()
add_executable(suppress_wer suppress_wer_set_error_mode.cpp)
endif()
@micjabbour
micjabbour / ppt2pdf.ps1
Last active January 12, 2021 02:30 — forked from mp4096/ppt2pdf.ps1
Batch convert PowerPoint files to PDF
################################################################################
# forked from https://gist.github.com/mp4096/1a2279ec7b3dfec659f58e378ddd9aee
# Modified to:
# 1) Create PDF files beside the converted PPT files
# 2) Skip already converted PPT files (if a PDF file with the same name already
# exists)
################################################################################
# Batch convert all .ppt/.pptx files encountered in folder and all its subfolders
# The produced PDF files are stored in the invocation folder
#
@micjabbour
micjabbour / main.cpp
Created July 2, 2018 13:12
Recursive lambdas in C++14
// lifted from stackoverflow documentation
// the example can currently be found hosted at:
// http://www.riptutorial.com/cplusplus/example/8508/recursive-lambdas
// original contributors:
// - Barry (https://stackoverflow.com/users/2069064/barry)
// - Yakk - Adam Nevraumont (https://stackoverflow.com/users/1774667/yakk-adam-nevraumont)
// thanks!
#include <iostream>
#include <utility>
@micjabbour
micjabbour / tree-traversal.cpp
Created June 22, 2018 11:50
Pre-oder and post-order tree traversal using iterators (C++ VS Python)
#include <iterator>
#include <stack>
#include <utility>
#include <vector>
class Node {
using Children = std::vector<Node>;
int n;
Children children;
class PreOrderRange {
@micjabbour
micjabbour / LICENSE.TXT
Last active July 24, 2018 18:02
A modified version of run-clang-tidy.py that is meant to be used in conjunction with pronto-clang_tidy runner
==============================================================================
LLVM Release License
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2007-2016 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
@micjabbour
micjabbour / main.cpp
Created April 6, 2018 19:22
A minimal test case for a possible bug in QHttpMultiPart that I am trying to track down
//the following file demonstrates a minimal test case for a possible bug in
//QHttpMultiPart. The request hangs completely when calling
//QApplication::processEvents() from a slot connected to
//QNetworkReply::uploadProgress. Note that this happens naturally when using
//QProgressDialog::setValue from a slot connected to uploadProgress signal (as
//setValue is documented to call QApplication::processEvents internally)
#include <QtWidgets>
#include <QtNetwork>
@micjabbour
micjabbour / main.cpp
Last active November 5, 2023 16:02
C++ WinAPI - get first physical drive serial number
#include <windows.h>
#include <memory>
#include <string>
//returns the serial number of the first physical drive in a std::string or an empty std::string in case of failure
//based on http://codexpert.ro/blog/2013/10/26/get-physical-drive-serial-number-part-1/
std::string getFirstHddSerialNumber() {
//get a handle to the first physical drive
HANDLE h = CreateFileW(L"\\\\.\\PhysicalDrive0", 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if(h == INVALID_HANDLE_VALUE) return {};
@micjabbour
micjabbour / main.cpp
Last active October 17, 2017 14:57
QSqlQueryModel eager loading example
//based on https://doc.qt.io/qt-5/qsqlquerymodel.html#fetchMore
#include <QtWidgets>
#include <QtSql>
#include <type_traits>
//comment out the next line to disable eager loading
#define QSQLMODEL_EAGER_LODING 1
//a class template that can be used to disable lazy loading
//in any QAbstractTableModel subclass