FIND YOUR NEXT FEW LINES

Results for “standard”

Small, practical examples. Search by task or narrow things down below.

703 snippets foundClear filters
C#Data & dates

Serialize an object to JSON

Serialize a small anonymous C# object with System.Text.Json.

C#✓ Tested
GoHTTP & URLs

Set and retrieve an HTTP header

Set and retrieve an HTTP header using a complete Go program with explicit sample inputs.

Go✓ Tested
CNumbers & memory

Set and test bit flags

Use unsigned masks to combine and test C flags.

C✓ Tested
RustThreads & shared ownership

Share immutable data with Arc

Share immutable data with Arc in a complete Rust program using the standard library.

Rust✓ Tested
Linux CommandsFiles & folders

Show the current directory

Print the absolute path of your current working directory before running commands that depend on relative paths.

directory✓ Tested
Linux CommandsText processing

Show the first lines of a file

Read only the first three lines of a text file, useful for checking a header or previewing a large log.

head✓ Tested
Linux CommandsSystem information

Show the Linux distribution version

Read the distribution-provided operating system name and version from os-release.

os✓ Tested
PythonDates & time zones

Skip weekends when advancing dates

Python: Walk calendar dates and count only Monday through Friday.

Python✓ Tested
JavaCollections

Sort a list

Sort a mutable Java list in natural ascending order.

Java✓ Tested
C++Collections

Sort a vector

Sort C++ integer values in ascending order.

C++✓ Tested
RustVectors & slices

Sort a vector in ascending order

Sort a vector in ascending order in a complete Rust program using the standard library.

Rust✓ Tested
Linux CommandsText processing

Sort and deduplicate lines

Sort lines alphabetically and remove duplicate lines in a predictable C locale.

sort✓ Tested