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
# Warning: not GC-safe: 't' [GcUnsafe] -- generated when using objects (t here) that have closures as member. | |
# Compile with --threads:on | |
type | |
TTTTT = object | |
onCalled: proc(i: int) {.closure.} | |
var | |
t: TTTTT # <== This is GCed, so the whole 't' instance is not gcsafe | |
x = 0 |
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
# Memory leak check | |
valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all program_name |
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
## Exception handling | |
try: | |
raise newException(IOError, "the drive is dirty") | |
except IOError: | |
echo "I/O error: " & getCurrentExceptionMsg() |
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
NAME='container-name' | |
# Things to know and understand | |
# - Docker needs to run at least one process inside, this is the command (CMD in Dockerfile) | |
# that defines the lifetime of the container | |
# - Docker will stop the container if the CMD stops | |
# - It is possible to run multiple processes inside one container (like from a shell) | |
# - Supervisor is a recommended tool to spawn and manage many processes | |
# Create + Run (run always creates a new container) |
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
sudo date +"%d%m%Y%H%M%S" -s "$(curl -v --insecure --silent https://google.com/ 2>&1 | grep -i -E -w '^< date\:' | sed -e 's/< date: //gI')" |
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
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
debugShowCheckedModeBanner: false, |