Skip to content

Instantly share code, notes, and snippets.

View 2bbb's full-sized avatar

2bit 2bbb

View GitHub Profile
@2bbb
2bbb / get_cloned
Last active March 7, 2016 12:22
get list of addons remote
#!/bin/bash
cd $1
FILES="./*"
for FILEPATH in $FILES;
do
if [ -d $FILEPATH ];
then
cd $FILEPATH
/usr/bin/git config --get remote.origin.url >/dev/null 2>&1
@2bbb
2bbb / cpwd
Created March 2, 2016 19:08
copy path of current directory to clipboard in terminal
#!/bin/bash
echo -n "`pwd`" | pbcopy
@2bbb
2bbb / flex_array.cpp
Last active January 13, 2016 13:37
flex_array
#include <iostream>
#include <array>
namespace bbb {
template <typename type>
using get_type = typename type::type;
namespace sequences {
template <typename type, type ... ns>
struct integer_sequence {
using value_type = type;
//
// logistic_regression.hpp
//
// Created by ISHII 2bit on 2016/01/08.
//
//
#pragma once
#include "vec.hpp"
@2bbb
2bbb / vector.cpp
Created January 8, 2016 06:55
vector
#include <iostream>
#include <type_traits>
#include <array>
#include <cmath>
#if 201402L <= __cplusplus
# define constexpr_14 constexpr
#else
# define constexpr_14
#endif
@2bbb
2bbb / ofApp.cpp
Last active January 6, 2016 14:31
linear regression study
#include "ofMain.h"
namespace linear_regression {
using default_value_type = float;
template <std::size_t num, typename value_type = default_value_type>
struct model {
using record = std::array<value_type, num>;
using result = value_type;
using datum = std::pair<record, result>;
@2bbb
2bbb / osx_sdk_setup.sh
Last active December 22, 2015 00:19
osx_sdk_setup
#!/bin/bash
# MacOSX-SDKs: download from https://github.com/phracker/MacOSX-SDKs
FROM=5
TO=10
CMD="/usr/bin/sudo /bin/ln -s"
MY_PATH=`pwd`
@2bbb
2bbb / method_checker.cpp
Created December 18, 2015 02:34
method_checker_macro
#define method_checker(name, method, result, ...)\
template <typename T>\
struct name {\
template <typename testee, result (testee::*)(__VA_ARGS__) = &testee::method> struct tester {};\
template <typename testee> static std::true_type test(tester<testee> *);\
template <typename> static std::false_type test(...);\
static constexpr bool has_method = decltype(test<T>(nullptr))::value;\
};
method_checker(has_update, update, void);
@2bbb
2bbb / iterator_delegation.cpp
Last active December 18, 2015 01:28
iterator_delegation
#include <type_traits>
#include <iterator>
namespace bbb {
template <typename container>
struct iteratable_class_traits {
#pragma mark iterator
struct forward_iterator_check {
@2bbb
2bbb / main.cpp
Created December 13, 2015 12:16
black_magic
#include <iostream>
#include <type_traits>
template<typename T, typename U>
struct lambda_check {
static constexpr bool value = !std::is_same<T, U>::value;
};
template <typename fun1, typename fun2>
constexpr bool is_lambda_(fun1, fun2) {