Skip to content

Instantly share code, notes, and snippets.

View longluo's full-sized avatar
💭
I may be slow to respond.

Frank Luo longluo

💭
I may be slow to respond.
View GitHub Profile
#include <cstdio>
#include <cmath>
#include <string>
#include "raylib.h"
#include "waterpool.hpp"
const int WIDTH = 160;
const int HEIGHT = 160;
using PoolType = Sapphire::WaterPool<WIDTH, HEIGHT>;

无用知识的有用性

弗莱克斯纳

[按] 30年代美国普林斯顿大学校长亚伯拉罕·弗莱克斯纳(Abraham Flexner)教授曾以 “无用知识的有用性”为题,发表过一篇在科学界有影响的文章。该文章强调了基础研 究以及自由探索的重要性。全文一万余字,现节译如下,以餐读者。

  智力与精神生活在表面上是一种无用型活动。人们之所以大量从事这种活动,是因

@rafael-fuente
rafael-fuente / Damped_Double_Pendulum_Simulation.py
Last active December 11, 2024 22:36
Damped Double Pendulum Simulation
#=======================================================================================================================================
# This script computes the equation of motion of a damped double pendulum using a full Newtonian analysis with sympy,
# then solve them numerically, and finally visualize the solution using matplotlib.
#=======================================================================================================================================
import sympy as sp
import numpy as np
import matplotlib.pyplot as plt
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@publik-void
publik-void / sin-cos-approximations-gist.adoc
Last active June 21, 2025 22:52
Fast MiniMax Polynomial Approximations of Sine and Cosine

Fast MiniMax Polynomial Approximations of Sine and Cosine

@Ashok-Varma
Ashok-Varma / install_android_sdk_tools_in_linux_for_custom_ci.md
Last active September 5, 2025 16:37
Install Android SDK tools in linux. Can be used for custom CI (Continuous Integration)
@simonbyrne
simonbyrne / paynehanek.jl
Last active November 18, 2023 02:39
Payne-Hanek reduction in Julia
import Base: TwicePrecision, significand_bits, significand_mask, exponent_mask, exponent_bias
# Bits of 1/2π
# 1/2π == sum(x / 0x1p64^i for i,x = enumerate(INV2PI))
# Can be obtained by:
#
# setprecision(BigFloat, 4096)
# I = 0.5/big(pi)
# for i = 1:19
# I *= 0x1p64
@gkhays
gkhays / DrawSineWave.html
Last active August 29, 2025 00:34
Oscillating sine wave, including the steps to figuring out how to plot a sine wave
<!DOCTYPE html>
<html>
<head>
<title>Sine Wave</title>
<script type="text/javascript">
function showAxes(ctx,axes) {
var width = ctx.canvas.width;
var height = ctx.canvas.height;
var xMin = 0;
public static float dist(float x1, float y1, float x2, float y2) {
return (float) Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
public static float getRayCast(float p0_x, float p0_y, float p1_x, float p1_y, float p2_x, float p2_y, float p3_x, float p3_y) {
float s1_x, s1_y, s2_x, s2_y;
s1_x = p1_x - p0_x;
s1_y = p1_y - p0_y;
s2_x = p3_x - p2_x;
@allenanie
allenanie / CouponCollectors.py
Created October 30, 2015 20:13
A Python simulation to Coupon Collector's Problem
# simulate coupon collector's problem
import numpy as np
def run(n):
"""
n: number of different coupons (stamps)
return: days it took to achieve such goal
"""