Skip to content

Instantly share code, notes, and snippets.

View alibitek's full-sized avatar
🌱
Growing

Alex Bitek alibitek

🌱
Growing
View GitHub Profile
@alibitek
alibitek / build_kdevelop.sh
Created February 2, 2016 12:37
Build KDevelop
export QT_SELECT=qt5; cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/Software/KDE/kdevelop5-git -DQT_QT_INCLUDE_DIR=/usr/include/qt5 -DCMAKE_CXX_FLAGS=-fPIC ..
@alibitek
alibitek / color_print.py
Created January 25, 2016 15:40
Python color print
#!/usr/bin/env python3
from collections import namedtuple
Colors = namedtuple('Colors', 'response, success, fail, end')
COLORS = Colors(
response='\033[94m',
success='\033[92m',
fail='\033[91m',
end='\033[0m',
@alibitek
alibitek / trim_string.cpp
Created September 23, 2015 11:56
C++ string trimming
// trim from start
static inline std::string &ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
return s;
}
// trim from end
static inline std::string &rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
return s;
@alibitek
alibitek / boost_asio_test.cpp
Created September 14, 2015 06:26
Boost ASIO test
#include <iostream>
#include <boost/thread.hpp>
#include <boost/asio.hpp>
#include <boost/scoped_ptr.hpp>
#include <cstdint>
#include <limits>
class X
{
private:
@alibitek
alibitek / qt_regex_test.cpp
Created September 14, 2015 06:24
QRegularExpression test
#include <QCoreApplication>
#include <QRegularExpression>
#include <QStringList>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QString text = R"delim({{infobox historic building
@alibitek
alibitek / test_random_device.cpp
Created September 14, 2015 06:16
Test Random Device
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <random>
#include <cmath>
int main()
{
// Seed with a real random value, if available
@alibitek
alibitek / test_pretty_func.cpp
Created September 14, 2015 06:16
Test __PRETTY_FUNCTION__
#include <iostream>
using namespace std;
namespace X { struct F { static void f() { cout << __PRETTY_FUNCTION__; } }; }
// Clang: static void X::F::f()
// GCC: static void X::F::f()
int main() { X::F::f(); }
@alibitek
alibitek / permutations.java
Created September 14, 2015 06:15
Permutations
import java.util.HashSet;
public class Permutations {
public static HashSet<String> permutations(String str) {
return permutations("", str);
}
private static HashSet<String> permutations(String prefix, String str) {
HashSet<String> result = new HashSet<>();
@alibitek
alibitek / svn_up_deep.sh
Created September 11, 2015 13:28
SVN update recursive
#!/usr/bin/env bash
function update ()
{
echo "Call to update ($1)"
if [ -d $1/.svn ]
then
echo "Updating $1..."
svn up $1
else
#!/bin/sh -e
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
scriptversion=2013-02-03.15
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
# Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify