Skip to content

Instantly share code, notes, and snippets.

View timchenkomo's full-sized avatar

Timchenko Mikhail timchenkomo

  • ASCON
  • Kolomna, Moscow Oblast, Russia
View GitHub Profile
@timchenkomo
timchenkomo / snippet.cpp
Created October 11, 2024 15:08 — forked from Jacob-Tate/snippet.cpp
Get EXE Location C++
//Returns the absolute path of the executable
std::filesystem::path file_manip::abs_exe_path()
{
#if defined(_MSC_VER)
wchar_t path[FILENAME_MAX] = { 0 };
GetModuleFileNameW(nullptr, path, FILENAME_MAX);
return std::filesystem::path(path);
#else
char path[FILENAME_MAX];
ssize_t count = readlink("/proc/self/exe", path, FILENAME_MAX);

Configuring Qt 6.x and CMake for windows 10

If you want to create a redistributable installer for a Qt app with Cmake then youve come to the right place... I ve been struggling to make Qt work with cmake on windows, and finally figure out something that works:

  1. Go ahead and download Qt: https://www.qt.io/download-qt-installer

  2. Start the install and select "Custom installation" image11

@timchenkomo
timchenkomo / equal-value-validator.ts
Created May 22, 2023 15:29
Angular 2 validator to compare two controls in a form (e.g. passwords on signup forms) v0.1
/** '/src/app/shared/equal-value-validator.ts' */
/** Just a demo/draft, please ensure your implementation is sound before going live */
import { FormGroup, ValidatorFn } from '@angular/forms';
/** this control value must be equal to given control's value */
export function equalValueValidator(targetKey: string, toMatchKey: string): ValidatorFn {
return (group: FormGroup): {[key: string]: any} => {
const target = group.controls[targetKey];
const toMatch = group.controls[toMatchKey];
@timchenkomo
timchenkomo / java-hibernate-sqlite.md
Created February 28, 2023 12:56 — forked from rppowell-lasfs/java-hibernate-sqlite.md
Java Hibernate-Sqlite Simple Example 2018-04-22

Java Hibernate/Sqlite Example

Dependencies

// https://mvnrepository.com/artifact/org.hibernate/hibernate-core
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.16.Final'

// https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc
compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.21.0.1'
@timchenkomo
timchenkomo / README.md
Created January 20, 2022 10:15 — forked from quinnjr/README.md
How to easily add environment variables to an Angular application

How to easily add environment variables to an Angular application

This guide assumes that you already have an angular application set up by ng create and are using Angular CLI for compilation.

Other guides that I've read rely upon re-writing your environments/environment.ts|environment.prod.ts files with each compilation. I find this to be completely unnecessary when angular's internal use of webpack can just be extended to include environment variables.

1. Add @angular-builders/custom-webpack to your dev-dependencies

Starting Postgresql in Windows without Install

Problem

This is a question that comes up quite often by windows users, so thought we would share how we normally do it. The question is

Can you run a PostgreSQL server on your windows desktop/server box without having to install anything?

The answer is

@timchenkomo
timchenkomo / pug.md
Created December 20, 2020 09:42 — forked from neretin-trike/pug.md
Туториал по HTML препроцессору Pug (Jade)
@timchenkomo
timchenkomo / meritt.zsh-theme
Created November 29, 2020 09:28 — forked from meritt/meritt.zsh-theme
My ZSH theme
# vim:ft=zsh ts=2 sw=2 sts=2
#
# Based on Agnoster's Theme — https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts)
# [Solarized theme](https://github.com/altercation/solarized/)
# [iTerm 2](http://www.iterm2.com/)
### Segment drawing
@timchenkomo
timchenkomo / .gitignore
Created November 14, 2020 10:49 — forked from salcode/.gitignore
.gitignore file for a general web project - Bare Minimum Git
# -----------------------------------------------------------------
# .gitignore
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20181206
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/10017553/raw/.gitignore
# to download this file
#
@timchenkomo
timchenkomo / fix-git-line-endings
Created November 5, 2020 03:32 — forked from ajdruff/fix-git-line-endings
Forces all line endings to LF in your git repo.
#####################
#
# Use this with or without the .gitattributes snippet with this Gist
# create a fixle.sh file, paste this in and run it.
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF