Skip to content

Instantly share code, notes, and snippets.

View x5lcfd's full-sized avatar
:octocat:
coding.

x5lcfd x5lcfd

:octocat:
coding.
View GitHub Profile
@x5lcfd
x5lcfd / lua-uuid.lua
Created October 20, 2017 08:24 — forked from jrus/lua-uuid.lua
quick lua implementation of "random" UUID
local random = math.random
local function uuid()
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function (c)
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
return string.format('%x', v)
end)
end
@x5lcfd
x5lcfd / tolua_GetCallStack.cs
Created December 29, 2017 12:32
tolua get call stack.
public static string tolua_GetCallStack(IntPtr L, string msg)
{
tolua_pushtraceback(L);
lua_pushstring(L, msg);
lua_pushnumber(L, 1);
if (lua_pcall(L, 2, -1, 0) == 0)
{
msg = lua_tostring(L, -1);
}
else

// url => https://superuser.com/questions/723612/ping-and-nslookup-work-browsing-doesnt/723617

I believe that nslookup opens a winsock connection on the DNS port and issues a query, whereas ping uses the DNS Client service. You could try and stop this service and see whether this makes a difference.

Some commands that will reinitialize various network states :

Reset WINSOCK entries to installation defaults : netsh winsock reset catalog
Reset TCP/IP stack to installation defaults : netsh int ip reset reset.log
Flush DNS resolver cache : ipconfig /flushdns
Renew DNS client registration and refresh DHCP leases : ipconfig /registerdns

@x5lcfd
x5lcfd / .clang-format
Last active August 30, 2018 16:48
clang format file
UseTab: Never
ColumnLimit: 0
IndentWidth: 4
AccessModifierOffset: -2
AllowShortIfStatementsOnASingleLine: false
AllowShortBlocksOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
IndentCaseLabels: false
BreakConstructorInitializers: BeforeComma
IndentCaseLabels: true
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
/// <summary>
/// A base class for creating editors that decorate Unity's built-in editor types.
/// </summary>
public abstract class DecoratorEditor : Editor
void SyncGameObjectWithUIElement(Vector3 entityPos, Canvas canvas, RectTransform parentRectTransform, RectTransform targetRectTransform)
{
Vector3 screenPos = Camera.main.WorldToScreenPoint(entityPos);
entityPos = screenPos / canvas.scaleFactor;
Rect rect = parentRectTransform.rect;
entityPos.x = entityPos.x - rect.width * 0.5f;
entityPos.y = entityPos.y - rect.height * 0.5f;
entityPos.z = 0;
//targetRectTransform.anchoredPosition3D = entityPos;
@x5lcfd
x5lcfd / Sublime.json
Created May 25, 2018 02:39
Sublime Configuration
// KeyBinding
[
{ "keys": ["ctrl+shift+i"], "command": "insert_date", "args": { "format": "%Y-%m-%d %I:%M"} },
{ "keys": ["ctrl+left"], "command": "move", "args": {"by": "subwords", "forward": false} },
{ "keys": ["ctrl+right"], "command": "move", "args": {"by": "subword_ends", "forward": true} },
{ "keys": ["alt+left"], "command": "jump_back" },
{ "keys": ["alt+right"], "command": "jump_forward" },
]
@x5lcfd
x5lcfd / SimpleDistanceFieldRaymarcher.glsl
Last active August 3, 2018 11:24
a simple distance field raymarcher
// https://www.shadertoy.com/view/lltczj
// https://www.reddit.com/r/twotriangles/comments/1hy5qy/tutorial_1_writing_a_simple_distance_field/
const int MAX_ITER = 100;
const float MAX_DIST = 20.0;
const float EPSILON = 0.001;
float sphere(vec3 pos, float radius)
{
return length(pos) - radius;
@x5lcfd
x5lcfd / SimpleHTTPServerWithUpload.py
Created August 6, 2018 12:13 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@x5lcfd
x5lcfd / google_array_size.cc
Created August 8, 2018 23:33
[GOOGLE_ARRAYSIZE]
#undef GOOGLE_ARRAYSIZE
#define GOOGLE_ARRAYSIZE(a) \
((sizeof(a) / sizeof(*(a))) / \
static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))