Skip to content

Instantly share code, notes, and snippets.

View dingmingxin's full-sized avatar
🎯
Focusing

EverDing dingmingxin

🎯
Focusing
View GitHub Profile
@dingmingxin
dingmingxin / orthodoxc++.md
Created December 6, 2021 05:14 — forked from bkaradzic/orthodoxc++.md
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@dingmingxin
dingmingxin / jenkins.sh
Created September 14, 2021 12:45 — forked from nicerobot/jenkins.sh
Create Jenkins group/user on Mac OS X
#!/bin/sh
# curl -Lks https://raw.github.com/gist/3889839/jenkins.sh | sudo sh -s
# from http://mattonrails.wordpress.com/2011/06/08/jenkins-homebrew-mac-daemo/
# open http://localhost:8080
brew list jenkins || brew install jenkins
mkdir /var/jenkins
/usr/sbin/dseditgroup -o create -r 'Jenkins CI Group' -i 600 _jenkins
dscl . -append /Groups/_jenkins passwd "*"
dscl . -create /Users/_jenkins
dscl . -append /Users/_jenkins RecordName jenkins
@dingmingxin
dingmingxin / build.gradle
Created November 14, 2020 02:07 — forked from tuanchauict/build.gradle
Auto switch signing configs for multiple-releases-product
apply from: 'release.gradle'
android{
productFlavors {
dev {
//...
}
//...
}

Last updated 2020/03/04

Some links from twitter on the topic of parsing PSD files (haven't looked into them in details). PSD include a flattened rasterized image so this is easy to load if that's the only thing you need. Most software / librairies have support for extracting this flattened data (e.g. stb_image.h does).

However if you want access to individual layers, render non-rasterized layers, emulate every photoshop features, extract or apply effects with more granularity, more code is needed. May range from easy to lots-of-work depending on what exactly you need.

As far as I know there isn't a trivial stb-like ready-to-use C++ library to do that sort of things. Posting all links here. Some are probably bloated or hard to use into your project, some lacking features.

TODO: Actually look into the pros/cons of all those.

@dingmingxin
dingmingxin / iOSDevices
Created September 24, 2019 06:09 — forked from erkanyildiz/iOSDevices
List of iOS devices with names and cpu models
{
"iPhone1,1":
{
"name": "iPhone",
"cpu": "RISC ARM 11"
},
"iPhone1,2":
{
"name": "iPhone 3G",
@dingmingxin
dingmingxin / prepare_icons.sh
Created November 27, 2018 08:05 — forked from Lerg/prepare_icons.sh
Make all app icons with imagemagick, iOS and Android
#!/bin/sh
base=$1
convert "$base" -resize '29x29' -unsharp 1x4 "Icon-Small.png"
convert "$base" -resize '40x40' -unsharp 1x4 "Icon-Small-40.png"
convert "$base" -resize '50x50' -unsharp 1x4 "Icon-Small-50.png"
convert "$base" -resize '57x57' -unsharp 1x4 "Icon.png"
convert "$base" -resize '58x58' -unsharp 1x4 "Icon-Small@2x.png"
convert "$base" -resize '60x60' -unsharp 1x4 "Icon-60.png"
convert "$base" -resize '72x72' -unsharp 1x4 "Icon-72.png"
convert "$base" -resize '76x76' -unsharp 1x4 "Icon-76.png"
@dingmingxin
dingmingxin / closures-basic.c
Created August 30, 2018 09:49 — forked from vidarh/closures-basic.c
A number of ways to implement closures in C, in preparation of an upcoming blog post
#include <stdio.h>
#include <stdlib.h>
struct closure {
void (* call)(struct closure *);
int x;
};
@dingmingxin
dingmingxin / restore-git-submodules.sh
Created August 15, 2018 08:28 — forked from aroemen/restore-git-submodules.sh
Restore git submodules from .gitmodules. Since git submodule init only considers submodules that already are in the index (i.e. "staged") for initialization this short script parses .gitmodules, and each url and path pair.
#!/bin/sh
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
git submodule add $url $path
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.Texture;
void HSV_to_RGB(float h, float s, float v, byte *r, byte *g, byte *b)
{
int i,f,p,q,t;
h = max(0.0, min(360.0, h));
s = max(0.0, min(100.0, s));
v = max(0.0, min(100.0, v));
s /= 100;
v /= 100;