Skip to content

Instantly share code, notes, and snippets.

View neugen86's full-sized avatar

Eugeny Neustroev neugen86

View GitHub Profile
@baiwfg2
baiwfg2 / CMakeLists.txt
Created September 29, 2018 12:42
How to use add_custom_target and add_custom_command correctly in cmake
# References:
# https://cmake.org/cmake/help/latest/command/add_custom_target.html
# https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/
# https://gist.github.com/socantre/7ee63133a0a3a08f3990
# https://stackoverflow.com/questions/24163778/how-to-add-custom-target-that-depends-on-make-install
# https://stackoverflow.com/questions/30719275/add-custom-command-is-not-generating-a-target
# https://stackoverflow.com/questions/26024235/how-to-call-a-cmake-function-from-add-custom-target-command
# https://blog.csdn.net/gubenpeiyuan/article/details/51096777
cmake_minimum_required(VERSION 3.10)
@mbinna
mbinna / effective_modern_cmake.md
Last active June 26, 2024 13:26
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@IronistM
IronistM / setup-elementary.sh
Last active May 8, 2023 18:52 — forked from floriancourgey/setup-elementary.sh
Things to do after installing elementary OS Loki 0.4
#Start with a dist upgrade
sudo apt dist-upgrade
# Get chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i ./google-chrome*.deb
sudo apt-get install -f
# dev (php, docker, git, node, bower, electron, composer)
sudo apt install -y \
@dragon788
dragon788 / longwindedname.md
Created November 25, 2016 23:39
Restore rEFInd as default boot manager from Windows after updates

After losing access to rEFInd yet again (Windows 10 Anniversary Edition), I was able to find the proper invocation of BCDEdit thanks to a helpful person on StackOverflow. None of the Microsoft documentation mentions this, but you NEED single quotes around {bootmgr} for sure if you are in the PowerShell shell, but possibly also if you are in the Command Prompt. This allowed me to add a new entry for rEFInd and I've had to do this multiple times so I know it works on Windows 10.

bcdedit /set {bootmgr} path \EFI\refind\refind_x64.efi 

becomes

bcdedit /set '{bootmgr}' path \EFI\refind\refind_x64.efi
@zakirt
zakirt / animated-gif-detect.js
Last active October 6, 2023 08:33
Detecting if GIF file is animated using JavaScript
/**
* @author Zakir Tariverdiev
* @class animatedGifDetect
* @description
* GIF file reader that checks whether GIF image is animated, or not.
* Uses information gathered from the website below:
* http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp
*/
(function(window, undefined) {
'use strict';
@VictorLaskin
VictorLaskin / Declaration.h
Last active April 16, 2020 23:47
Immutable-serializable structure in C++11
// Immutable serialisable data structures in C++11
// Example code from http://vitiy.info/immutable-data-and-serialisation-in-cpp11/
// Written by Victor Laskin (victor.laskin@gmail.com)
class ScheduleItemData : public IImmutable {
public:
const time_t start;
const time_t finish;
SERIALIZE_JSON(ScheduleItemData, start, finish);
};
@VictorLaskin
VictorLaskin / MVJSON.cpp
Created July 23, 2015 08:42
MVJSON - my old lib for JSON reading / writing
/*
*
* Compact JSON format parsing lib (native cross-platform c++)
*
* Copyright (C) 2013 Victor Laskin (victor.laskin@gmail.com)
* Details: http://vitiy.info/?p=102
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@Iman
Iman / clean.sh
Last active June 23, 2024 12:46
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@Nimrodda
Nimrodda / Android.mk
Created March 5, 2015 14:36
Sample Android.mk with prebuilt static library
LOCAL_PATH := $(call my-dir)
# hatch library
include $(CLEAR_VARS)
LOCAL_MODULE := prebuilt-static-lib
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libprebuilt-static-lib.a
# The header files should be located in the following dir relative to jni/ dir
LOCAL_EXPORT_C_INCLUDES := include/
include $(PREBUILT_STATIC_LIBRARY)
@m-ou-se
m-ou-se / clock.scad
Last active December 11, 2016 12:48
3D model for my whiteboard clock
$fs=1;
$fa=1;
servo_l = 24;
servo_w = 13;
servo_h = 21;
bolt_hole_diameter = 4.5;
servo_axis_diameter = 4;