- intro, download, install & setup
- basics, syntax
- control flow
- more types, data structures
- methods & interfaces
- concurrency
- nice to know stuff
- golang gotchas <-- especially if you are coming from python, ruby etc
- workspace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright (c) 2015-2021, bacondither | |
| // All rights reserved. | |
| // | |
| // Redistribution and use in source and binary forms, with or without | |
| // modification, are permitted provided that the following conditions | |
| // are met: | |
| // 1. Redistributions of source code must retain the above copyright | |
| // notice, this list of conditions and the following disclaimer | |
| // in this position and unchanged. | |
| // 2. Redistributions in binary form must reproduce the above copyright |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "net" | |
| "time" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| A blood black nothingness began to spin. | |
| Began to spin. | |
| Let's move on to system. | |
| System. | |
| Feel that in your body. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| dbus-monitor --system "type='signal',path='/org/freedesktop/UPower/devices/battery_BAT0',member='PropertiesChanged'" | while read LINE; do | |
| echo ${LINE} | grep battery_BAT0 | grep -q PropertiesChanged | |
| if [ $? -eq 0 ]; then | |
| BATT_STAT=$(dbus-send --print-reply=literal --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/devices/battery_BAT0 org.freedesktop.DBus.Properties.Get string:org.freedesktop.UPower.Device string:State | awk '{ print $3; }') | |
| if [ $BATT_STAT -eq 1 ] || [ $BATT_STAT -eq 4 ]; then | |
| LEVEL=$(tuned-adm list | grep -q throughput-performance && echo "throughput-performance" || echo "balanced") | |
| elif [ $BATT_STAT -eq 5 ]; then | |
| LEVEL="balanced" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| You will need to add you user to the 'apache' group first. Log out afhter you have done that. | |
| $ sudo mkdir /var/www/html/project | |
| $ sudo chown -R $USER:apache /var/www/html/project | |
| $ sudo chmod -R 775 /var/www/html/project |
Go provides file-opening flags represented by constants defined in the os package. These flags determine the behavior of file operations, such as opening, creating, and truncating files. The following is a list of the flags and what they do.
-
os.O_RDONLY: Opens the file as read-only. The file must exist. -
os.O_WRONLY: Opens the file as write-only. If the file exists, its contents are truncated. If it doesn't exist, a new file is created. -
os.O_RDWR: Opens the file for reading and writing. If the file exists, its contents are truncated. If it doesn't exist, a new file is created.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package cache | |
| import ( | |
| "sync" | |
| "time" | |
| ) | |
| // Cache is a basic in-memory key-value cache implementation. | |
| type Cache[K comparable, V any] struct { | |
| items map[K]V // The map storing key-value pairs. |
- !! underscore
_in filename == slash/ - I'm using podman instead of Docker. Systemd files were generated by podman (not quadlet).
- certbot image has to be pulled manually
- before first start, a certificate has to be requested. Nginx won't start if it's not there. You can request one using certbot in standalone mode:
podman run -it --rm -p 80:80 -v ~/nginx/data/letsencrypt:/etc/letsencrypt:z -v ~/nginx/log:/var/log:z certbot/certbot certonly --standalone --staging --dry-run --key-type ecdsa --rsa-key-size 4096 -d immich.domain.tld - ports forwarded and opened: 80/TCP, 443/UDP and 443/TCP
directory structure has to look like this. directories and logfiles may have to be created manually. check startup errors.
$ home - nginx
OlderNewer