This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk '/insert_code_start/,/insert_code_end/ { if ( $0 ~ /insert_code_end/) print " // insert code here"; next} 1' < test.cpp > text_sub.cpp | |
# | |
# Example | |
# | |
# void main(){ | |
# // insert_code_start | |
# foo(); | |
# // insert_code_end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.cpp | |
// Observer pattern in C++11 | |
// | |
// Created by Morten Nobel-Jørgensen on 9/21/12. | |
// Copyright (c) 2012 Morten Nobel-Joergensen. All rights reserved. | |
// | |
#include <iostream> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
#include <deque> | |
#include <mutex> | |
// Reuseable blocking queue | |
template <typename T> class BlockingQueue { | |
std::deque<T> q; | |
std::mutex m; | |
std::condition_variable cv; | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------- | |
# | |
# Project created by QtCreator 2013-07-08T13:26:39 | |
# | |
#------------------------------------------------- | |
QT += core gui widgets opengl network | |
TARGET = QtImageCompressionTest | |
CONFIG += console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// cpp11shim.h | |
// | |
// Created by Morten Nobel-Jørgensen on 7/19/13. | |
// Copyright (c) 2013 Morten Nobel-Joergensen. All rights reserved. | |
// | |
#ifndef __CPP11_SHIM__ | |
#define __CPP11_SHIM__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple oldskool "plasma effect", a bunch of combined sine waves | |
// input x,y (uv-coordinates), t (time) | |
int vv = int( | |
(127.0f + (127.0f * sinf(x/7.0f+t))) + | |
(127.0f + (127.0f * sinf(y/5.0f-t))) + | |
(127.0f + (127.0f * sinf((x+y)/6.0f-t))) + | |
(127.0f + (127.0f * sinf(sqrtf(float(x*x + y*y))/4.0f-t))) | |
) / 4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using standard definitions from the make environment, typically: | |
# | |
# CC cc C compiler | |
# CXX g++ C++ compiler | |
# CFLAGS [ ] flags for C and C++ compiler | |
# CPPFLAGS [ ] flags for C and C++ compiler | |
# TARGET_ARCH [ ] target architecture | |
# FFLAGS [ ] flags for Fortran compiler | |
# RM rm -f delete a file | |
# AR ar create a static *.a library archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Loosely based on http://superuser.com/a/533706 | |
ffmpeg -framerate 10 -i shot\ %04d.png -s:v 1280x720 -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p smart-avenue-1.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Threading; | |
using System.Text; | |
public class HelloSocketWorld : MonoBehaviour { | |
public string history; | |
public string txt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <chrono> | |
using namespace std; | |
// Based on http://stackoverflow.com/a/5524138/420250 | |
int main() | |
{ | |
typedef std::chrono::high_resolution_clock Clock; | |
using FpMilliseconds = std::chrono::duration<float, std::chrono::milliseconds::period>; |