Skip to content

Instantly share code, notes, and snippets.

@carlessanagustin
carlessanagustin / win2ix.md
Last active May 4, 2024 10:44
Windows and Unix command line equivalents
Windows command Unix command Notes
set env Set on Windows prints a list of all environment variables. For individual environment variables, set is the same as echo $ on Unix.
set Path export $PATH Print the value of the environment variable using set in Windows.
set PROJ -- result: PROJ=c:\project
echo %PROJ% echo $PROJ result: c:\project

|

/**
* WordPress dependencies
*/
import { createPortal, useEffect, useState } from '@wordpress/element';
import { registerPlugin } from '@wordpress/plugins';
import { Button } from '@wordpress/components';
function MyToolbarButton() {
// Lazy and one time initializations, also gives us a stable reference.
const [ container ] = useState( () => {
@pdarcey
pdarcey / SwiftData.md
Last active May 4, 2024 10:30
SwiftData storage on the Mac

SwiftData storage on the Mac

Where does SwiftData store things on the Mac?

Default Storage Location

On iOS, this directory is in the app's own storage location (app_UUID/Library/Application Support) but, on the Mac, it's a shared location in the user's Library.

By default on the Mac, SwiftData stores its model in the /~/Library/Application Support directory as default.store. (It will also add two other files, default.store-shm and default.store-wal, as the model is stored as a SQLite database, and these are these additional files are part of how SQLite works.)

@jimevans
jimevans / NetworkInterception.cs
Last active May 4, 2024 10:30
Selenium C# network traffic logging example
public async Task LogNetworkRequests(IWebDriver driver)
{
INetwork interceptor = driver.Manage().Network;
interceptor.NetworkRequestSent += OnNetworkRequestSent;
interceptor.NetworkResponseReceived += OnNetworkResponseReceived;
await interceptor.StartMonitoring();
driver.Url = "http://the-internet.herokuapp.com/redirect";
await interceptor.StopMonitoring();
}
@ngschmidt
ngschmidt / draw_zones.yml
Created January 7, 2024 20:03
Ansible Build DNS Zones from SoT
---
- name: "Build DNS Zonefiles"
hosts: localhost
vars:
zones:
- name: "add_here.zone"
zonename: "add_here"
soa: "ns"
settings:
ttl: "2d"
@karpathy
karpathy / min-char-rnn.py
Last active May 4, 2024 10:26
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
/*
Delta Compression by Glenn Fiedler.
This source code is placed in the public domain.
http://gafferongames.com/2015/03/14/the-networked-physics-data-compression-challenge/
*/
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
@JunkFood02
JunkFood02 / Motion.kt
Last active May 4, 2024 10:25
A music player demo made with Jetpack Compose animation APIs, including shared element transition, list animations, animated content, etc.
package com.example.compose_debug
import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.Easing
import androidx.compose.animation.core.FastOutLinearInEasing
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.PathEasing
@brabect1
brabect1 / sta_cdc_paths.rst
Last active May 4, 2024 10:23
Timing constraints for clock-domain crossings. #sta #cdc