Skip to content

Instantly share code, notes, and snippets.

@kouk
kouk / How to add a submodule with shallow checkout and shallow clone
Last active April 17, 2024 20:16
.How to add a submodule with shallow checkout and shallow clone
If you have a huge repository (in size and in history) and want to add a subfolder
to your project as a submodule you can follow this example to save time and space
using git's shallow clone and shallow checkout feature. It is a bit more complicated
in this example because I assume that you want your submodule to track a non-default
branch, called `mybranch`, instead of the `master` branch. Things could probably get
a lot simpler when using the default branch. After following the commands in these
examples you can use `git submodule update` and `git submodule update --remote` as normal.
@Rod-Persky
Rod-Persky / CMakeLists.txt
Last active January 31, 2024 12:57
Example cmake for windows including auto copy dll
# _______ __ __ _______ ______ _______ _______ _______ ______ #
#| || | | || || | | _ || || || | #
#| _ || | | ||_ _|| _ || |_| ||_ _|| ___|| _ |#
#| | | || |_| | | | | | | || | | | | |___ | | | |#
#| |_| || | | | | |_| || | | | | ___|| |_| |#
#| || | | | | || _ | | | | |___ | |#
#|_______||_______| |___| |______| |__| |__| |___| |_______||______| #
# #
# Modern CMake practices and importing the QT scripts by adding it to #
# your module path makes things a lot better than it used to be #
@dalelane
dalelane / xmldiff.py
Created October 6, 2014 02:03
Comparing XML files ignoring order of attributes and elements - see http://dalelane.co.uk/blog/?p=3225 for background
##########################################################################
#
# xmldiff
#
# Simple utility script to enable a diff of two XML files in a way
# that ignores the order or attributes and elements.
#
# Dale Lane ([email protected])
# 6 Oct 2014
#

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

@pfultz2
pfultz2 / fusion-orm.cpp
Created July 16, 2014 15:53
A simple example of how to use Boost.Fusion for ORM
#include <iostream>
#include <sstream>
#include <type_traits>
#include <boost/mpl/range_c.hpp>
#include <boost/fusion/adapted/struct/define_assoc_struct.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
#include <boost/fusion/algorithm/transformation/zip.hpp>
#include <boost/fusion/sequence/intrinsic/at_c.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
@alanning
alanning / bundle
Last active May 19, 2016 12:22
Bash shell script that bundles Meteor app and includes date and latest git commit hash in destination filename. By default, will not bundle is there are uncommitted changes but you can override with the `-f` flag. Properly handles branches as well.
#!/bin/bash
set -o nounset
set -o errexit
FORCE=false
# Read parameters
# http://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
@vittorioromeo
vittorioromeo / FastFunc.hpp
Last active August 24, 2023 08:15
Don Clugston's fast delegate C++11 implementation
#ifndef SSVU_FASTFUNC
#define SSVU_FASTFUNC
#include <cstring>
#include <type_traits>
#include <cassert>
#include <cstddef>
#include <memory>
#include <new>
#include <utility>
@preshing
preshing / list_modifications.py
Last active January 21, 2016 04:44
List the contents of folders recursively, sorted by modification time.
#! /usr/bin/env python
# License: http://creativecommons.org/publicdomain/zero/1.0/
# See http://preshing.com/20130115/view-your-filesystem-history-using-python
import optparse
import os
import fnmatch
import time
# Parse options
parser = optparse.OptionParser(usage='Usage: %prog [options] path [path2 ...]')
@mausch
mausch / gitwatchall.sh
Created February 17, 2012 03:34
Watches all repositories in a given github network
user="mausch"
token="your_github_token"
mainrepo="mausch/solrnet"
urls=$(curl -s "https://github.com/api/v2/json/repos/show/$mainrepo/network" | python -mjson.tool | grep "url" | grep -vi "$mainrepo" | sed -re 's/.*(https.*)".*/\1/')
for url in $urls; do
remote=$(echo $url | cut -d/ -f4-5)
curl -F "login=$user" -F "token=$token" "https://github.com/api/v2/json/repos/watch/$remote"
echo
done
@mausch
mausch / gitremoteaddall.sh
Created February 17, 2012 03:19
Adds all github forks in the network for a particular repository
mainrepo="mausch/solrnet"
urls=$(curl -s "https://api.github.com/repos/$mainrepo/forks" | grep git_url | sed -re 's/.*: "(.*)",/\1/')
for url in $urls; do
remote=$(echo $url | cut -d/ -f4)
git remote add $remote $url
done