Skip to content

Instantly share code, notes, and snippets.

View Luiz-Monad's full-sized avatar
💭
computing

Luiz Luiz-Monad

💭
computing
View GitHub Profile
@VictorTaelin
VictorTaelin / TaelinArena.md
Last active January 14, 2020 23:12
Taelin Arena

Taelin Arena

Uma arena online feita em uma nova linguagem de programação ultra-segura desenvolvida por nós, o Formality. O jogo será non-profit, get-paid-to-win: todo seu lucro é redirecionado pros próprios jogadores competitivos. Também será open-source e 100% modável: jogadores poderão criar seus próprios heróis. Será um jogo competitivo, real-time, top-view e muito dinâmico. O gameplay será uma mistura de League of Legends

@pps83
pps83 / ctz_clz.cpp
Last active June 17, 2024 10:45
__builtin_ctz (ctzl, ctzll) and __builtin_clz (clzl, clzll) for Visual Studio
// Note, bsf/bsr are used by default.
// Enable /arch:AVX2 compilation for better optimizations
#if defined(_MSC_VER) && !defined(__clang__)
#include <intrin.h>
static __forceinline int __builtin_ctz(unsigned x)
{
#if defined(_M_ARM) || defined(_M_ARM64) || defined(_M_HYBRID_X86_ARM64) || defined(_M_ARM64EC)
return (int)_CountTrailingZeros(x);
@nojaf
nojaf / subPath.fsx
Last active August 26, 2019 19:15
Suave subPath
open System
open Suave
open Suave.Filters
let subPath path (ctx:HttpContext) =
async {
let localPath = ctx.request.url.LocalPath
let result =
match (localPath.StartsWith(path)) with
| false -> None
@H2CO3
H2CO3 / test_guard.rs
Created October 15, 2017 18:58
Protect against forgetting to call a test case evaluation function
fn make_test_evaluator() -> Box<Fn(YourTestCaseTypeHere)> {
use std::cell::RefCell;
struct EvalGuard(bool);
impl Drop for EvalGuard {
fn drop(&mut self) {
if !self.0 {
panic!("Did not actually evaluate test cases");
}
@ekmett
ekmett / math_constexpr.h
Last active November 2, 2022 21:56
Computing Spherical Harmonics
#pragma once
#include <limits>
#define _USE_MATH_DEFINES
#include <math.h>
namespace framework {
namespace math_constexpr {
int constexpr abs(int x) {
@secretGeek
secretGeek / Download_Worry_Dream_References.linq
Created February 11, 2016 00:59
LinqPad script that downloads all PDFs/etc from Bret Victors worry dream refs page.
void Main()
{
// LinqPad script that downloads all PDFs/etc from Bret Victors worry dream refs page.
var targetPath = @"PATH_TO_WHERE_YOU_KEEP_YOUR_EBOOK\eBooks";
//These filenames were extracted from http://worrydream.com/refs/ -- using NimbleText.
//(TODO: Use regex or html agility pack to find them programmatically)
var refs = new string[] {
"Hamming-TheArtOfDoingScienceAndEngineering.pdf",
"Licklider-IntergalacticNetwork.pdf",
@dsyme
dsyme / gist:bfed2eed788c7ba58ccc
Last active July 4, 2022 22:23
Naked type aliases can add and name constraints
// This F# language suggestion wants a way to name collections of constraints:
// http://fslang.uservoice.com/forums/245727-f-language/suggestions/8509687-add-constraints-as-a-language-construct
//
// This is a type alias X<T> = T, so X<int> = int etc.
type X<'T> = 'T
// This is a type alias X<T> = T which adds a constraint
type WithStruct<'T when 'T : struct> = 'T
{-# LANGUAGE UnicodeSyntax #-}
module Proof where
import System.Console.ANSI
import Prelude.Unicode
import Control.Monad.Unicode
{-
Calculations and mathematical proofs of circular computations.
@author Marcelo Camargo
-}
@costerwi
costerwi / raspbian.md
Last active March 4, 2024 19:12
Raspbian startup

Normal Raspbian startup sequence

/usr/bin/raspi-config is a shell script to change some of the following options. docs

  1. /etc/inittab sets the default runlevel and runs /etc/init.d/rc to execute startup scripts.
  2. /etc/rc3.d/S03lightdm launches lightdm for runlevel 3.
  3. /etc/lightdm/lightdm.conf contains configuration options for lightdm, including autologin-user
  4. /etc/X11/Xsession sources all files in /etc/X11/Xsession.d
  5. /etc/X11/Xsession.d/50x11-common_determine-startup will set STARTUP to either ~/.xsession or ~/.Xsession if it exists. If not executable, it will prepend ${SHELL:-sh}. The default is STARTUP=/usr/bin/x-session-manager which is linked to /etc/alternatives/x-session-manager which is linked to /usr/bin/startlxde-pi
  6. lxde is the "Lightweight X11 Desktop Environment"
  7. `/usr/bin/startlxde