Skip to content

Instantly share code, notes, and snippets.

View ArthurSonzogni's full-sized avatar
🎯
Focusing

Arthur Sonzogni ArthurSonzogni

🎯
Focusing
View GitHub Profile
@ArthurSonzogni
ArthurSonzogni / .vimrc
Created November 25, 2014 12:37
minimal acceptable vim
set nocompatible
" map jj to escape
imap jj <Esc>
" activate mouse control
set mouse=a
@ArthurSonzogni
ArthurSonzogni / Chemical formula parser
Last active August 29, 2015 14:18
Parse chemical expression (ie : (CH4)2HeLi )
#include <iostream>
#include <sstream>
typedef std::map<std::string,int> chemicalComposition;
void transferChemical(chemicalComposition& left, chemicalComposition& right)
{
for(chemicalComposition::iterator it = right.begin(); it!=right.end(); ++it)
left[it->first] += it->second;
@ArthurSonzogni
ArthurSonzogni / Print.hpp
Last active March 3, 2016 15:43
qdebug() like object that avoid interleaving issues in a multiprocess / multithread environment.
/* ---------------------------------------------------------------------------
* ** This software is in the public domain, furnished "as is", without technical
* ** support, and with no warranty, express or implied, as to its usefulness for
* ** any purpose.
* **
* ** The file provide a way to avoid interleaved printing in a multithreaded
* ** environment. It works like qDebug() for the Qt framework
* **
* ** Usage :
* ** Print() << " The debug value = " << 42;
#ifndef SATURATE_CAST_HPP
#define SATURATE_CAST_HPP
#include <cmath>
// because C++ doesn't allow partial function
// specialization, we must use static method
// from specialized class
//-----------
@ArthurSonzogni
ArthurSonzogni / create_bitbucket_repositories.sh
Created March 8, 2016 11:46
Use bitbucket REST api to create and update all git repository in the directory. ( push into bitbucket team )
#!/bin/bash
echo -n "username in lowercase : "
read username
echo -n "password : "
read password
echo -n "team : "
read team
for r in $(echo */)
do
repo=${r%%/}
@ArthurSonzogni
ArthurSonzogni / date.sh
Created March 9, 2016 09:23
bash date command to display date in a compatible format for filename (in french)
date +"%y_%m_%d_%Hh%Mmin%Ssec"
@ArthurSonzogni
ArthurSonzogni / todo.cpp
Created March 14, 2016 13:43
TODO written in TODO
// TODO TODO TODO TODO TODO TODO TODO
// TODO TODO TODO TODO TODO TODO TODO
// TODO TODO TODO TODO TODO TODO TODO
// TODO TODO TODO TODO TODO TODO TODO
// TODO TODO TODO TODO TODO TODO TODO
// TODO TODO TODO TODO TODO
/// ----------------------------------------------------------
/// Author : ArthurSonzogni
/// License : MIT
/// Description : wrap a QVboxLayout into a QScrollArea
/// if the QVBoxLayout is to big, a scroll bar
/// appear and let the user scroll
/// ----------------------------------------------------------
#ifndef BUILDSCROLLABLEWIDGETLIST_H
#define BUILDSCROLLABLEWIDGETLIST_H
#!/bin/bash
# +---------------------------------------+
# | Open commit's files as buffers in vim |
# +---------------------------------------+
if [ -z $1 ]
then
# No argument provided => use the latest commit's files.
commit=HEAD
@ArthurSonzogni
ArthurSonzogni / CP1252_to_UTF8.hpp
Last active April 28, 2022 07:44
Convert Windows-1252 (aka CP1252) to UTF8
/*
MIT License
Copyright (c) 2017 Arthur Sonzogni
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is