- 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 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=$(powerprofilesctl list | grep -q performance && echo "performance" || echo "balanced") | |
elif [ $BATT_STAT -eq 5 ]; then | |
LEVEL="balanced" |
This file contains 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 |
This file contains 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. |