Skip to content

Instantly share code, notes, and snippets.

@johannes-z
johannes-z / customDirectives.js
Last active September 8, 2017 13:17
[WIP] Vue directive to generate HTML from a (scoped) slot and values.
import Vue from 'vue'
/**
* Usage:
* <span v-slot:one="{ slots, value: 'component B2' }"></span>
* v-slot:<SLOT_NAME>="{ slots, <VALUE> }"
*
* Pass the slots like this:
* <my-component :slots="$scopedSlots" />
* inside MyComponent define props: ['slots']

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@qgp9
qgp9 / SafeFormatter.h
Last active September 29, 2016 16:30
#include <string>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <stdlib.h>
class SafeFormatter{
public:
SafeFormatter( const char * s ):fForm(s),fIterator(fForm.begin()){}
void compile(){return ;}
template< typename T, typename ... A >
@qgp9
qgp9 / pythonic_range.cxx
Created September 19, 2016 23:06
pythonic range in C++11x
#include <iostream>
#include <vector>
#include <algorithm>
class Ranger {
public:
typedef int value_type;
struct iterator {
iterator(size_t counter) : counter(counter) {}
iterator operator++(){ return iterator(++counter); }
bool operator!=(iterator o) { return counter != o.counter; }
@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 / 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

@haje01
haje01 / 도커와 AWS를 활용한 클라우드 딥러닝 환경 구축.md
Last active December 20, 2020 08:56
도커와 AWS를 활용한 클라우드 딥러닝 환경 구축

도커와 AWS를 활용한 클라우드 딥러닝 환경 구축

글쓴이: 김정주(haje01@gmail.com)

최근 딥러닝 관련 패키지들은 대부분 CPU와 GPU를 함께 지원하고 있습니다. GPU를 사용하면 보다 빠르게 학습 결과를 낼 수 있지만, GPU를 활용하기 위해서는 NVIDIA계열의 그래픽 카드, 드라이버 S/W 그리고 CUDA의 설치를 필요로 합니다.

이 글에서는 AWS의 GPU 인스턴스와 도커를 활용해 딥러닝 패키지(Caffe)를 편리하게 사용하는 방법을 소개합니다.


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>{
@karpathy
karpathy / min-char-rnn.py
Last active July 24, 2024 18:36
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)