Skip to content

Instantly share code, notes, and snippets.

View zhaoguohao's full-sized avatar
🚩
🐬

zhaoguohao

🚩
🐬
  • SkyStar Studio
  • YeShan Planet Earth
View GitHub Profile
@EricJ2190
EricJ2190 / RandomWallpaper.cs
Created November 2, 2011 02:08
Random Windows Wallpaper
/* Selects a random image from a folder and makes it the desktop wallpaper.
* usage: RandomWallpaper.exe [c:\path\to\wallpapers]
* If the path is omitted, the current directory is used.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
@jboner
jboner / latency.txt
Last active July 17, 2024 03:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@jpsarda
jpsarda / FDrawingSprite.cs
Last active December 11, 2023 04:17
A class to draw lines with Futile, 2D engine for Unity3D. API inspired from Flash AS3 drawing API. Works with transparent colors. Cap styles : NONE, ROUND, SQUARE, TRIANGLE, ARROW Joint styles : MITER, ROUND, BEVEL Experimental (but working for most usages) support of borders (so far only supported with styles NONE / BEVEL).
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/* Author @jpsarda
* A drawing class.
*
* Examples :
*
@oldcai
oldcai / compression_benchmark.py
Last active March 30, 2024 13:11
zlib vs lz4 vs lzma vs zstd compression
import time
import requests
import zlib
#!pip install lz4 pylzma zstd
import lz4.block
import pylzma as lzma
import zstd
def measure_time_and_compress_decompress(compress_func, decompress_func, data, *args):
# Measure compression time
@rxaviers
rxaviers / gist:7360908
Last active July 17, 2024 08:59
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@jpsarda
jpsarda / Blur.shader
Last active December 11, 2023 04:36
A Blur CG shader for Futile (Unity 3D)
Shader "Futile/Blur"
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Color ("Main Color", Color) = (1,0,0,1.5)
_BlurAmount ("Blur Amount", Range(0,02)) = 0.0005
}
Category
@amowu
amowu / GetStreamingAssetsPath.cs
Created December 25, 2013 08:24
Get Unity StreamingAssets file path with Android and iOS.
// Put your file to "YOUR_UNITY_PROJ/Assets/StreamingAssets"
// example: "YOUR_UNITY_PROJ/Assets/StreamingAssets/db.bytes"
string dbPath = "";
if (Application.platform == RuntimePlatform.Android)
{
// Android
string oriPath = System.IO.Path.Combine(Application.streamingAssetsPath, "db.bytes");
@jpsarda
jpsarda / TrailPath.cs
Last active December 11, 2023 04:35
Trail FX for Futile 2D engine (Unity3D). Works on any custom node as long as you provide a CreateClone method. See description and usage in code. https://vine.co/v/MzpwETVAKIT
using UnityEngine;
using System;
using System.Collections.Generic;
/*
*
* Trail FX for Futile 2D engine (Unity3D). Works on any custom node as long as you provide a CreateClone method.
* FSpriteTrail provided as an example.
* https://vine.co/v/MzpwETVAKIT
*
@mathiassoeholm
mathiassoeholm / DancePad.cs
Created February 12, 2014 22:56
Unity dance pad input
using System;
using System.Collections.Generic;
using UnityEngine;
using Object = UnityEngine.Object;
namespace DancePadInput
{
public enum Player
{
Any,
@jpsarda
jpsarda / Fractals.cs
Created March 23, 2014 14:59
Fun with Fractals and Futile (Unity). A simple C# class to play with animated fractals. (You need also FSpriteTrail https://gist.github.com/jpsarda/8760429 )
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.IO;
/*
FractalElement e = new FractalElement(60f,true,4);
Color c=RandomUtils.RandomColor();