Skip to content

Instantly share code, notes, and snippets.

@Xipiryon
Xipiryon / count.sh
Last active June 25, 2024 10:29
Git: Get commit count for specific folder
#!/bin/bash
git log --name-only --pretty=format: -- $1 | sort | uniq -c | head -n 1
# --name-only = Show only names of changed files
# --pretty=format: = Remove the information, leaving only filenames
# -- $1 = Only show commits in that path (expected as argument)
# first sort will make sure things are sorted, so ...
# ... uniq -c can effectively merge all duplicates lines, counting them
@sooop
sooop / StreamReader.swift
Last active June 23, 2024 22:49
Read a large text file line by line - Swift 3
import Foundation
class StreamReader {
let encoding: String.Encoding
let chunkSize: Int
let fileHandle: FileHandle
var buffer: Data
let delimPattern : Data
var isAtEOF: Bool = false
@linse
linse / Makefile
Created May 21, 2014 17:15
Recursive make and make clean
SUBDIRS = src doc whatever
.PHONY: all clean
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir -f Makefile $@; \
done