Skip to content

Instantly share code, notes, and snippets.

View opensvn's full-sized avatar
🎯
Focusing

opensvn opensvn

🎯
Focusing
View GitHub Profile
#include <iostream>
template <size_t Input>
constexpr size_t OnesCount = (Input % 2) + OnesCount<(Input / 2)>;
template <> constexpr size_t OnesCount<0> = 0;
int main() {
std::cout << OnesCount<45> << std::endl;
return 0;
@opensvn
opensvn / nutstore_git.sh
Last active September 2, 2017 07:17
If a file in local git repository has no write permission, nutstore will stuck in analyzing that file. This script add write permission to the files modified in a day, so nutstore can upload those files.
#!/usr/bin/env bash
today=`date +%Y-%m-%d`
check_modify_time() {
file=$1
modify_date=`stat $file | grep -i Modify | awk -F. '{print $1}' | awk '{print $2}'`
if [ ${today} = ${modify_date} ]; then
return 0
fi