Skip to content

Instantly share code, notes, and snippets.

View chaosddp's full-sized avatar

Chaos Yu chaosddp

  • Beijing
  • 00:07 (UTC +08:00)
View GitHub Profile
@chaosddp
chaosddp / test.gd
Created September 27, 2022 01:56 — forked from winston-yallow/test.gd
Godot 4.x Compute Example
extends Node
# Based on this tweet by Clay John:
# https://twitter.com/john_clayjohn/status/1306447928932753408
func _ready() -> void:
# Create a local rendering device.
var rd := RenderingServer.create_local_rendering_device()
@chaosddp
chaosddp / MonoGameFontUtil.cs
Created September 9, 2022 04:13 — forked from Muscipular/MonoGameFontUtil.cs
monogame dynamic draw font, using SharpFont, and cache with texture2d
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using SharpFont;
namespace MonoFont
{
@chaosddp
chaosddp / FontTool.cs
Created September 9, 2022 04:06 — forked from SenpaiSharp/FontTool.cs
using SharpFont with Monogame
#region MIT License
/*Copyright (c) 2016 Robert Rouhani <robert.rouhani@gmail.com>
SharpFont based on Tao.FreeType, Copyright (c) 2003-2007 Tao Framework Team
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
@chaosddp
chaosddp / admin_check.ps1
Created January 5, 2018 09:24
Check if running as Admin
([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
@chaosddp
chaosddp / FixedWindow.lua
Created May 2, 2017 10:35
Call a win32 api to make the window size cannot be changed in Defold engine, as it using LuaJIT on Windows
local ffi = package.preload.ffi()
if(ffi.os == "Windows") then
-- definitions
ffi.cdef([[
typedef unsigned int LONG;
typedef long long LONG_PTR;
typedef void* PVOID;
typedef PVOID HANDLE;
Battery Saver
ms-settings:batterysaver
Battery Saver Settings
ms-settings:batterysaver-settings
Battery use
ms-settings:batterysaver-usagedetails
Bluetooth
ms-settings:bluetooth
Colors
@chaosddp
chaosddp / gist:9d77d0b9441ce2573f76a884a0821243
Created September 23, 2016 08:30
cmd to create uwp package
@if "%VS140COMNTOOLS%"=="" goto error_no_VS140COMNTOOLSDIR
@call "%VS140COMNTOOLS%VsDevCmd.bat"
MSBuild path/to/projectfile /p:Configuration=Release;Platform=x86;AppxBundle=Never;BuildAppxUploadPackageForUap=true;OutDir="path/for/output"
@goto end
:error_no_VS140COMNTOOLSDIR
echo "no vs dir found!"
var httpBaseProtocolFilter = new HttpBaseProtocolFilter();
httpBaseProtocolFilter.CookieManager.SetCookie(httpCookie);
ContactPicker pickcer = new ContactPicker();
pickcer.DesiredFieldsWithContactFieldType.Add(ContactFieldType.PhoneNumber);
pickcer.SelectionMode = ContactSelectionMode.Fields;
var contact = await pickcer.PickContactAsync();
// maybe not exist this
if (ApiInformation.IsTypePresent("Windows.Phone.Devices.Notification.VibrationDevice"))
{
var vibrateDevice = Windows.Phone.Devices.Notification.VibrationDevice.GetDefault();
var duration = TimeSpan.FromMilliseconds(1000);
vibrateDevice.Vibrate(duration);
}