Skip to content

Instantly share code, notes, and snippets.

Books

Links

  • Build your own X, a repo containing a lot of projects teaching how to build cool things, from a database from scratch, 3D stuffs and other cool features
  • tpetricek/Teaching a repo containing study material to things like PL
@chockenberry
chockenberry / PrivacyInfo.xcprivacy
Last active April 19, 2024 18:39
PrivacyInfo.xcprivacy sample
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
@davidbalbert
davidbalbert / Text+String.swift
Last active April 19, 2024 18:39
Hack to extract a String from SwiftUI.Text
// Cursed! Do not use!
// Supports most, but not all Text initializers.
import SwiftUI
extension FormatStyle {
func format(any value: Any) -> FormatOutput? {
if let v = value as? FormatInput {
return format(v)
@davepcallan
davepcallan / ChatGPTAPIExample.cs
Created March 7, 2024 13:02
Simple example of integrating with ChatGPT API from .NET
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.Text;
using System.Text.Json;
namespace Samples;
public class ChatGPTAPIExample(ILogger<ChatGPTAPIExample> logger, IConfiguration configuration)
{
private string Prompt = "Please explain the following code :";
@MitchRatquest
MitchRatquest / setup_gitea.sh
Last active April 19, 2024 18:37
Setup a local gitea server with nginx proxy
#!/bin/bash
#this script sets up a git user, installs gitea, a systemd service, and an nginx subdomain redirect
#inspired by https://golb.hplar.ch/2018/06/self-hosted-git-server.html
DOMAIN=EXAMPLE.COM #Please put your actual domain here
GIT_HOME=/opt/git #/home/git in the above tutorial
GITEA_PORT=3000 #default, but you can change it
if [[ $EUID -ne 0 ]]; then
echo "you need to be root"
exit 1
@thelindat
thelindat / myclass.lua
Last active April 19, 2024 18:30
ox_lib class example
-- ref: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Classes_in_JavaScript
-- Person Class
---@class Person : OxClass
---@field name string
local Person = lib.class('Person')
function Person:constructor(name)
print('calling Person constructor for', name)
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active April 19, 2024 18:25
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@cwhite92
cwhite92 / fqcn_from_path.php
Last active April 19, 2024 18:25
Get the FQCN from a PHP file specified by file path
<?php
public static function fqcnFromPath(string $path): string
{
$namespace = $class = $buffer = '';
$handle = fopen($path, 'r');
while (!feof($handle)) {
$buffer .= fread($handle, 512);