View test.py
import sys | |
from PyQt5.QtQml import * | |
from PyQt5.QtWidgets import * | |
from PyQt5.QtGui import * | |
from PyQt5.QtCore import * | |
class ClassA(QObject): | |
bChanged = pyqtSignal() |
View main.c
/* | |
* This file is part of the libopencm3 project. | |
* | |
* Copyright (C) 2010 Gareth McMullin <gareth@blacksphere.co.nz> | |
* | |
* 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. | |
* |
View cmake.py
# license MIT | |
# Hsu Yu Lun | |
import subprocess | |
import json | |
import time | |
def start(executable_file): | |
return subprocess.Popen( | |
executable_file, |
View launch.json
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "(gdb) Launch", | |
"type": "cppdbg", | |
"request": "launch", | |
"program": "${workspaceFolder}/build/binary.elf", | |
"args": [], | |
"stopAtEntry": false, |
View subscribe.py
# 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] |
View color_test.c
#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}; |
View bmploader.cpp
// 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 |
View Sudoku.c
#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); |
View gist:cdf47151d4064f572bc5
#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; |
View gs.glsl
#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]; |