This file contains hidden or 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
| --[[ deepcopy.lua | |
| Deep-copy function for Lua - v0.2 | |
| ============================== | |
| - Does not overflow the stack. | |
| - Maintains cyclic-references | |
| - Copies metatables | |
| - Maintains common upvalues between copied functions (for Lua 5.2 only) | |
| TODO |
This file contains hidden or 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
| void main(void) { | |
| // the center of the texture | |
| vec2 center = vec2(iResolution.x/2.0,iResolution.y/2.0); | |
| // current pixel location | |
| vec2 loc = gl_FragCoord.xy; | |
| // how far we are from the center | |
| float radius=length(loc-center); | |
This file contains hidden or 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
| // = Requirements: freetype 2.5, libpng, libicu, libz, libzip2 | |
| // = How to compile: | |
| // % export CXXFLAGS=`pkg-config --cflags freetype2 libpng` | |
| // % export LDFLAGS=`pkg-config --libs freetype2 libpng` | |
| // % clang++ -o clfontpng -static $(CXXFLAGS) clfontpng.cc $(LDFLAGS) \ | |
| // -licuuc -lz -lbz2 | |
| #include <cassert> | |
| #include <cctype> | |
| #include <iostream> | |
| #include <memory> |
This file contains hidden or 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
| -- copy.lua | |
| -- | |
| -- Lua functions of varying complexity to deep copy tables. | |
| -- | |
| -- 1. The Problem. | |
| -- | |
| -- Here's an example to see why deep copies are useful. Let's | |
| -- say function f receives a table parameter t, and it wants to |
This file contains hidden or 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
| //compiled gcc fonttest.c -o fonttest -lfontconfig | |
| //Sample output: /usr/share/fonts/steam-fonts/arial.ttf | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <fontconfig/fontconfig.h> | |
| int main() | |
| { | |
| FcConfig* config = FcInitLoadConfigAndFonts(); | |
| //make pattern from font name | |
| FcPattern* pat = FcNameParse((const FcChar8*)"Arial"); |
This file contains hidden or 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
| var express = require('express'); | |
| var cookieParser = require('cookie-parser'); | |
| var session = require('express-session'); | |
| var flash = require('express-flash'); | |
| var handlebars = require('express-handlebars') | |
| var app = express(); | |
| var sessionStore = new session.MemoryStore; | |
| // View Engines |
This file contains hidden or 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
| // returns 1.0 if inside circle | |
| float disk(vec2 r, vec2 center, float radius) { | |
| return 1.0 - smoothstep( radius-0.005, radius+0.005, length(r-center)); | |
| } | |
| // returns 1.0 if inside the disk | |
| float rectangle(vec2 r, vec2 bottomLeft, vec2 topRight) { | |
| float ret; | |
| float d = 0.005; | |
| ret = smoothstep(bottomLeft.x-d, bottomLeft.x+d, r.x); | |
| ret *= smoothstep(bottomLeft.y-d, bottomLeft.y+d, r.y); |
This file contains hidden or 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
| set(LIBFOO_TAR_HEADERS | |
| "${CMAKE_CURRENT_BINARY_DIR}/include/foo/foo.h" | |
| "${CMAKE_CURRENT_BINARY_DIR}/include/foo/foo_utils.h" | |
| ) | |
| add_custom_command(OUTPUT ${LIBFOO_TAR_HEADERS} | |
| COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_CURRENT_SOURCE_DIR}/libfoo/foo.tar" | |
| COMMAND ${CMAKE_COMMAND} -E touch ${LIBFOO_TAR_HEADERS} | |
| WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/foo" | |
| DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/libfoo/foo.tar" |
This file contains hidden or 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
| Copyright 2025 Chun-Min Chang | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # | |
| # gh-dl-release! It works! | |
| # | |
| # This script downloads an asset from latest or specific Github release of a | |
| # private repo. Feel free to extract more of the variables into command line | |
| # parameters. | |
| # | |
| # PREREQUISITES | |
| # |
OlderNewer