Skip to content

Instantly share code, notes, and snippets.

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

x5lcfd x5lcfd

:octocat:
coding.
View GitHub Profile
/*
The C# version of https://github.com/cloudwu/lua-snapshot on https://github.com/topameng/tolua_runtime
*/
using System;
using System.Text;
using LuaInterface;
public static class Snapshot
{
private readonly static int TABLE = 1;
@x5lcfd
x5lcfd / ProFi.lua
Created August 13, 2018 12:48 — forked from perky/ProFi.lua
ProFi, a simple lua profiler that works with LuaJIT and prints a pretty report file in columns.
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()
// Place your settings in this file to overwrite the default settings
{
"editor.fontSize": 15,
"editor.fontFamily": "'Consolas', 'Inziu IosevkaCC SC'",
"editor.fontLigatures": true,
"editor.renderLineHighlight": "none",
"editor.letterSpacing": 0,
"editor.minimap.enabled": false,
"editor.occurrencesHighlight": false,
"editor.cursorBlinking": "smooth",
@x5lcfd
x5lcfd / smallpt.cc
Last active September 9, 2018 08:55
the explanation of smallpt.
#include <iostream>
#include <random>
#include <cstdlib>
#include <cstdio>
#include "erand48.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif // !M_PI
// https://doxygen.postgresql.org/erand48_8c_source.html
#pragma once
#include <cmath>
#define RAND48_SEED_0 (0x330e)
#define RAND48_SEED_1 (0xabcd)
#define RAND48_SEED_2 (0x1234)
#define RAND48_MULT_0 (0xe66d)
import numpy as np
import matplotlib.pyplot as plt
import time as time
total_random_points = int(input("\nNumber of random points for Monte Carlo estimate value of PI?\n>"))
start_time = time.time()
inside_circle = 0
@x5lcfd
x5lcfd / emacs-start.bat
Last active September 13, 2018 04:16
emacs related.
REM https://www.emacswiki.org/emacs/EmacsMsWindowsIntegration
c:\path\to\emacs\bin\emacsclientw.exe -c -n -a c:\path\to\emacs\bin\runemacs.exe
@x5lcfd
x5lcfd / aligned_allocator.h
Created September 21, 2018 11:19
an aligned allocator.
#pragma once
#include <memory_resource>
inline void* _aligned_malloc(size_t size, size_t alignment)
{
void* res = 0;
void* ptr = malloc(size + alignment);
if (ptr != 0)
{
origins = {
{+1*^5 + 1, 40.8, 81.6},
{-1*^5 + 99, 40.8, 81.6},
{50, 40.8, 1*^5},
{50, 40.8, -1*^5+170},
{50, 1*^5, 81.6},
{50, -1*^5 + 81.6, 81.6},
{27, 16.5, 47},
{73, 16.5, 48},
{50, 681.6 - 0.27, 81.6}
@x5lcfd
x5lcfd / vim_cheatsheet.md
Created October 4, 2018 05:08 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close