Skip to content

Instantly share code, notes, and snippets.

@qgp9
qgp9 / multivector.cxx
Created July 23, 2016 09:45
Multi-Dimensional Array with vector, template
#include <iostream>
#include <vector>
//=====================================================
// V1 : Wraper class of vector ( has vector )
//=====================================================
template < class T , int dim >
class MultiVector {
public:
@qgp9
qgp9 / 0.testPrivateInClass.py
Last active July 25, 2016 07:58
python private/protected method test
# python private/protected method test
class MyClass:
def __init__(self):
self.publicMember1 = "Public Member"
self._privateMember1 = "Private Member"
self.__protectedMember1 = "Protected Member"
def printPublic(self):
print ("This is Public Method")
@qgp9
qgp9 / README.md
Last active January 14, 2017 13:36
ssh/config manager
@qgp9
qgp9 / tmon.sh
Last active August 8, 2016 15:13
monitoring with tmux
#!/bin/bash
com=${1:-"htop"}
tname=mon
twin=mon
tnw=$tname:$twin
tmux has-session -t $tname
if [ $? != 0 ]
then
tmux new-session -s $tname -n $twin -d ssh -t a1 "$com"
@qgp9
qgp9 / makeThumb.md
Last active June 6, 2017 07:18
Make a tumbnail of snapshots from a movie clip

How to make a tumbnail of snapshots from a movie clip with libAV

@qgp9
qgp9 / rename.pl
Last active March 24, 2016 05:27
rename source
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long 2.24, qw( :config bundling no_ignore_case no_auto_abbrev );
my ( $N, $EXT, @EXT, @USE, $DECODE, $ENCODE );
sub compile { eval shift } # defined early to control the lexical environment
my $msglevel = 0;
@qgp9
qgp9 / myClass.js
Created March 9, 2016 11:12
idea of strict class template like C++
'use strict'
/*================ Requires =====================================*/
//let utils = require( './utils' );
/*================ Class Variables/Constants ====================*/
let methods ; // Mandatory
const CODE_STRING = '<<code>>';
let someClassVariable = 'someClassVariable';
@qgp9
qgp9 / Happiness.js
Created February 1, 2016 13:36
happiness function
function Happiness(t){
return t + "free";
}
template < class T, int n > struct mvector_tool{
typedef vector< typename mvector_tool<T,n-1>::type > type;
static type gen_vector( std::array<unsigned int, n> index, T initvalue ){
std::array<unsigned int,n-1> index_next;
std::copy_n( index.begin()+1, n-1, index_next.begin() );
return type( index.front(), mvector_tool<T,n-1>::gen_vector( index_next, initvalue ));
}
};
template < class T > struct mvector_tool<T,0>{