Skip to content

Instantly share code, notes, and snippets.

View ilyvion's full-sized avatar

Alexander Krivács Schrøder ilyvion

View GitHub Profile
@T-Dark0
T-Dark0 / what_as_does.md
Last active November 18, 2024 15:43
What `as` does

as does a huge number of things. Probably too many. Here's a comprehensive list of everything it can do. Entries in italics are the names of functions that actually exist in the standard library, while all entries attempt to have a descriptive name for what a function that does the same thing as that particular as would do.

  • int <-> int
    • zero_extend: unsigned int -> bigger unsigned int. Pads the number with leading zeroes. This preserves the numeric value.
    • sign_extend: signed int -> bigger signed int. Pads the number with leading zeroes if positive, and leading ones if negative. This preserves the numeric value.
    • truncate: bigger int -> smaller int (regardless of signedness). Throws away the high bits of the number.
    • reinterpret_sign: int -> int of the same size and opposite signedness. Does nothing to the bits.
  • int <-> float
  • cast_saturate_to_infinity: Yields the float closest to the specified integer. Yields infinity if the integer is out of boun
@werwolfby
werwolfby / <Custom>DbContext.cs
Last active September 16, 2024 11:32
EF Core DateTime Utc kind
public class CustomDbContext : DbContext
{
// ...
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
// Replace default materializer source to custom, to convert DateTimes
options.ReplaceService<IEntityMaterializerSource, DateTimeKindEntityMaterializerSource>();
base.OnConfiguring(options);
@oxguy3
oxguy3 / deploy.php
Last active April 16, 2025 07:58
Script used to automatically deploy from GitHub to a cPanel shared hosting server
<?php
/**
* deploy.php by Hayden Schiff (oxguy3)
* Available at https://gist.github.com/oxguy3/70ea582d951d4b0f78edec282a2bebf9
*
* No rights reserved. Dedicated to public domain via CC0 1.0 Universal.
* See https://creativecommons.org/publicdomain/zero/1.0/ for terms.
*/
// random string of characters; must match the "Secret" defined in your GitHub webhook