Skip to content

Instantly share code, notes, and snippets.

View jsonzilla's full-sized avatar

Jason jsonzilla

View GitHub Profile
@jsonzilla
jsonzilla / color_generator.cpp
Created August 29, 2023 12:56
Color generator
#include <iostream>
#include <vector>
#include <random>
#include <algorithm>
#include <cmath>
struct Color {
int r, g, b;
Color(int r, int g, int b) : r(r), g(g), b(b) {}

Fix ONLY_FULL_GROUP_BY error

Reference

List all curent global modes in MySql

mysql -sse "SELECT @@GLOBAL.sql_mode;" 

or direct in a sql in

@jsonzilla
jsonzilla / README.md
Last active May 3, 2023 13:07
Simple LOC

Simple LOC

This script counts the lines of code in a C++ codebase. It reads files with the extensions cpp, h, hpp, cmake and CMakeList.txt and ignores blank lines. It also has the ability to ignore certain folders by matching their names to a pattern.

To use this script, you need to have Python 3.7+ installed on your system. You can run the script from the command line by navigating to the directory where the script is located and running the following command:

python script.py path/to/codebase

Where path/to/codebase is the path to the codebase you want to count lines of code for.

By default, the script will not exclude any folders. If you want to exclude certain folders from the line count, you can edit the exclude_folders variable in the script and add the names of the folders you want to exclude.

@jsonzilla
jsonzilla / checkLastModified.h
Last active March 7, 2023 20:59
Check the lask modified, if changed return true;
#include <chrono>
#include <sys/types.h>
#include <sys/stat.h>
std::chrono::time_point<std::chrono::system_clock> lastChangedFileTime;
bool SomeClass::NeedReload
{
struct stat result;
if (stat(filePath.c_str(), &result) == 0) {
@jsonzilla
jsonzilla / error_collection_crashfix.md
Last active March 4, 2024 19:23
fix for group by error in crashfix webservice

Group by error

If crashfix webserver show the error:

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #9 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'crashfix.b.status' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Execute the query below:

SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
@jsonzilla
jsonzilla / crashfix_cleanup_routine.md
Last active March 4, 2024 19:23
Crashfix Cleanup Routine

Crashfix Cleanup Routine

Check the disk size

$ df -h
...
/dev/nvme0n1p1   500G  404G   76G  85% /
...
#include <windows.h>
#include <GL/gl.h>
#include <stdio.h>
#pragma comment(lib, "opengl32.lib")
void glview()
{
HWND hWnd = CreateWindow(L"ListBox", L"Title", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL);
HDC hDC = GetDC(hWnd);
@jsonzilla
jsonzilla / VS16NoTelem.bat
Created August 4, 2021 22:40
Disable telemetry in Visual Studio 2019
@echo off
fltmc >nul 2>&1 || (
echo This batch script requires administrator privileges. Right-click on
echo the script and select "Run as administrator".
goto :die
)
rem Change this path if you are using Community or Professional editions
set "VS_INSTALL_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise"
@jsonzilla
jsonzilla / html2md-with-pandoc.sh
Created August 27, 2019 15:01 — forked from bzerangue/html2md-with-pandoc.sh
RECURSIVELY Bash convert all your html to markdown files (with Pandoc)
find . -name "*.ht*" | while read i; do pandoc -f html -t markdown "$i" -o "${i%.*}.md"; done