Skip to content

Instantly share code, notes, and snippets.

@boxmein
boxmein / gist:f4199c8807808b116521
Last active May 1, 2024 04:32
how to write lua scripts

Lua Coding Tutorial

You may use the contents of this document according to the CC BY-NC-SA license.

Also available on: 360 Tech Explorer

This is a really simple tutorial to get you started coding Lua for The Powder Toy. It tries to expect no programming knowledge of the reader, and tries to give the reader an idea of how to think algorithmically as well as how to

@digitalshadow
digitalshadow / OpenSimplexNoise.cs
Last active May 1, 2024 04:32
OpenSimplex Noise Refactored for C#
/* OpenSimplex Noise in C#
* Ported from https://gist.github.com/KdotJPG/b1270127455a94ac5d19
* and heavily refactored to improve performance. */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace NoiseTest
@selimb
selimb / example_project.py
Last active May 1, 2024 04:29
FastAPI lifespan-scoped (singleton) dependencies
########
# app.py
########
# Example of how I use it in my project. This file cannot be run as-is.
# The only difference with the example in the fastapi_singleton module docstring is
# the use of a subclassed FastAPI application to define type annotations
import fastapi
import fastapi_singleton
@anchan828
anchan828 / README.md
Last active May 1, 2024 04:26
This is an improvement to allow @nestjs/typeorm@8.1.x to handle CustomRepository. I won't explain it specifically, but it will help in some way. https://github.com/nestjs/typeorm/pull/1233

You need to provide some classes and decorators yourself to maintain the same style as typeorm@2.x.

1. EntityRepository -> CustomRepository

@EntityRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}

@qwfys
qwfys / 202005281327.md
Last active May 1, 2024 04:24
国内拉取google kubernetes镜像
package com.kaaneneskpc.richtexteditor
import android.annotation.SuppressLint
import android.os.Environment
import android.widget.Toast
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
@matthewzring
matthewzring / markdown-text-101.md
Last active May 1, 2024 04:18
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

What this guide covers:

@slavistan
slavistan / cuda-ready-archlinux-for-wsl2.md
Last active May 1, 2024 04:17
CUDA-ready Archlinux for WSL2

This is a brief guide on how to install Archlinux as a WSL2 distribution and how to set up CUDA afterwards.

As of late, Window's WSL2 offers GPU passthrough from WSL2/Linux to Windows for NVidia graphics cards which allows to run (and develop) CUDA-based applications on the WSL2/Linux-side with almost native performance. Unfortunately, the official guides for the CUDA setup for WSL2/Linux are predominantly Ubuntu-specific. Here's to you, Arch!

1. Install Archlinux

  1. Make sure that your Windows meets the dependencies and that your WSL2 is set up. See these instructions.

Archlinux is not among the default distributions available for WSL2. We'll install it from a tarball instead, a functionality offered natively by the WSL.

@barnabyalter
barnabyalter / gist:67fc5342794b82e70a04c6fb4284e265
Created May 16, 2019 16:57
Use httpie to test eshelf cors
#!/bin/bash
COOKIE_VALUE='L1NJRXM5eXkxMVhYMnUwNlRtVjd5Q3JWOGVtSjdxY0NneXBuSlNpQmdhb2xZZ2pyR3RCRENFamJSV1E4QXhqZkJpeVlGeTFzQ2UyalQ1RnI5ZHJWWGdvSG5NcFAxK05ramc4MGVKdnhWOEtOSUxaMlJWeGNocHFOWkh1aktmQy9lbHliYllhalhpWUFZYkVpWDkvdTZNdTRvd2JQYmxURnoyVGdUMHdXWVRMU3hVNGdFbWlnQ2U2c2RVbEMvS2FKK2NqTjl6U2ZwU2xtS09wdHlqNGJ2U05URVFaUmNydkxjY0VWNGJpSTd6U1poOWpxaWE1K09TZ01oTkdLYjljTVdLbVd1UWVRSHc1WkhMbjR6cUpCeklnNmNOUXVxS1FyU2xWUmxYbVBWdE09LS1oY1JibHM2RnZ5bStVRm0yYXFuYXBRPT0%3D--1878c3d65e1c28cdd2da459577e8fb9894e2cd7a'
CSRF_TOKEN='yOcFwFaW/ZdCZZj2Co1s8Va2+f6RFx3IYjKiup505yDm1HOi7Cq5IAoi8CaRdOIZEt8akygs1pph6W7M910j+g=='
# http GET localhost:3000/records/from/primo.json per=all _=123456 'Origin:http://localhost:8004'
http GET localhost:3000/records/from/primo.json per=all _=123456 'Origin:http://localhost:8004' \
"Cookie:_eshelf_session=${COOKIE_VALUE}; path=/; HttpOnly" "X-CSRF-Token:${CSRF_TOKEN}"
# http POST localhost:3000/records.json \
# record:='{"external_system":"primo","external_id":"dedupmrg412226627"}' \