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
func Retry[T any](effector func(ctx context.Context) (T, error), retries int, delay time.Duration) func(context.Context) (*T, error) { | |
return func(ctx context.Context) (*T, error) { | |
for r := 0; ; r++ { | |
response, err := effector(ctx) | |
if err == nil || r >= retries { | |
// Return when there is no error or the maximum amount | |
// of retries is reached. | |
return &response, err | |
} |
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
class DB { | |
private static $cfg = array( | |
'write' => | |
array('mysql:dbname=MyDB;host=10.1.2.3'), | |
'read' => | |
array('mysql:dbname=MyDB;host=10.1.2.7', | |
'mysql:dbname=MyDB;host=10.1.2.8', | |
'mysql:dbname=MyDB;host=10.1.2.9'); | |
); | |
public static function getConnection($pool) { |
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
[osiris@iside] ~ $ ./viron | |
Hello world, from Viron! | |
~ $ mount | |
Viron: added viron@fuse0 - mounted by osiris | |
~ $ exit | |
Viron: umounted viron@fuse0 | |
[osiris@iside] ~ $ |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/conf.h> | |
#include <env/history.h> | |
#define HISTORY_SIZE 10 | |
#define FIRST_ELEMENT 0 | |
#define LAST_ELEMENT (HISTORY_SIZE - 1) | |
// private function -- dealloc element in history at position x |
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
#ifndef __MEMAGENT_H | |
#define __MEMAGENT_H | |
#include <stdarg.h> | |
#include <stdlib.h> | |
#include <sys/conf.h> | |
// safe free with the checks if ptr exist | |
// before cleaning | |
static inline void safefree(void *ptr) { |
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
--- src/constants.h 2012-12-29 09:59:37.000000000 +0100 | |
+++ src/constants.h 2012-12-29 09:59:16.000000000 +0100 | |
@@ -103,7 +103,9 @@ | |
#define INCLUDES 8 | |
#define FIELDS 10 | |
-#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__ | |
+#if (__APPLE__) | |
+# define TERMINFO 1 | |
+#elif (BSD || V9) && !__NetBSD__ && !__FreeBSD__ |
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
osiris@Gentoo ~ $ du -sh /boot/kernel-x86_64-3.7.1-gentoo | |
3.9M /boot/kernel-genkernel-x86_64-3.7.1-gentoo | |
osiris@Gentoo ~ $ du -sh /lib/modules/3.7.1-gentoo/ | |
260K /lib/modules/3.7.1-gentoo/ | |
osiris@Gentoo ~ $ uname -a | |
Linux Gentoo 3.7.1-gentoo #1 SMP Mon Dec 24 16:42:53 CET 2012 x86_64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz GenuineIntel GNU/Linux | |
osiris@Gentoo ~ $ |