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
import sys | |
from PyQt5.QtQml import * | |
from PyQt5.QtWidgets import * | |
from PyQt5.QtGui import * | |
from PyQt5.QtCore import * | |
class ClassA(QObject): | |
bChanged = pyqtSignal() |
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
/* | |
* This file is part of the libopencm3 project. | |
* | |
* Copyright (C) 2010 Gareth McMullin <[email protected]> | |
* | |
* This library is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU Lesser General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* |
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
# license MIT | |
# Hsu Yu Lun | |
import subprocess | |
import json | |
import time | |
def start(executable_file): | |
return subprocess.Popen( | |
executable_file, |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "(gdb) Launch", | |
"type": "cppdbg", | |
"request": "launch", | |
"program": "${workspaceFolder}/build/binary.elf", | |
"args": [], | |
"stopAtEntry": false, |
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
# arr = [1, 2, 3, 4, 5] | |
arr = np.arange(5) | |
# [1, 2, 3] | |
arr[[0, 1, 2]] | |
# [1, 3, 5] | |
arr[[True, False, True, False, True]] | |
# [4, 5] | |
arr[arr>3] |
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 <stdio.h> | |
/* reference: http://misc.flogisoft.com/bash/tip_colors_and_formatting */ | |
#define GRAY "\e[90m" | |
#define RED "\e[91m" | |
#define GREEN "\e[92m" | |
#define DEFAULT "\e[39m" | |
const int num_colors = 3; | |
const char *colors[] = {GRAY, RED, GREEN}; |
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
// mini bmp loader written by HSU YOU-LUN | |
unsigned char *load_bmp(const char *bmp, unsigned int *width, unsigned int *height, unsigned short int *bits) | |
{ | |
unsigned char *result=nullptr; | |
FILE *fp = fopen(bmp, "rb"); | |
if(!fp) | |
return nullptr; | |
char type[2]; | |
unsigned int size, offset; | |
// check for magic signature |
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 <stdio.h> | |
#define ROWS 9 | |
#define COLS 9 | |
#define SQ 3 | |
#define MAX (SQ*SQ) | |
static void read_question(FILE *fp); | |
static int find_blank(int *, int *); | |
static int solve(int, int); |
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
#version 330 | |
layout(points) in; | |
layout(triangle_strip, max_vertices=6) out; | |
in vec3 vColor[1]; | |
out vec3 lightPos; | |
out vec3 lightColor; | |
uniform mat4 view; | |
// e: near | |
// a: aspect: height/width; | |
uniform float e=0.1, a=1.0; |
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
#version 330 | |
layout(triangles) in; | |
layout(triangle_strip, max_vertices=3) out | |
uniform int enableSmooth=1; | |
in vec3 vNorm[3]; | |
in vec3 vWorldPos[3]; | |
in vec2 vTexCoord[3]; |