Skip to content

Instantly share code, notes, and snippets.

View zplusfour's full-sized avatar

zplusfour

View GitHub Profile
@malted
malted / sveltekit-init
Last active April 3, 2022 09:10
Initialise a Sveltekit project & push to a new repository.
#!/bin/bash
if [ -d "$1" ]; then # If the directory exists
if [ "$(ls -A $1)" ]; then
# The directory exists & contains files
echo "$1 is not empty. Exiting."
exit 0
else
# The directory exists & is empty
rmdir $1
fi
export DISPLAY=$(powershell.exe -Command '(Get-NetIPAddress -AddressFamily IPv4 | Where-Object {$_.AddressState -eq "Preferred" -and ($_.InterfaceAlias -eq "Wi-Fi" -or $_.InterfaceAlias -eq "Ethernet")}).IPAddress' | sed 's/.$//'):0.0
export LIBGL_ALWAYS_INDIRECT=1
@flaviocopes
flaviocopes / check-substring-starts-with.go
Last active June 23, 2024 09:05
Go: check if a string starts with a substring #golang
package main
import (
"strings"
)
func main() {
strings.HasPrefix("foobar", "foo") // true
}