Systemd is a suite of basic building blocks for a Linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system. There are cases that you want to run a script or job on a Linux server and keep track of the logs without an external library and also get the benfit of seamless control over the application lifecycle on the server. Systemd provides all of this out of the box. In this simple example I tried to demonstrate the use case with a simple Express hello world server that is developed in Typescript and TS-Node.
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
#include <libpq-fe.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
void close_connection(PGconn *connection, int code) { | |
PQfinish(connection); | |
exit(code); | |
} | |
// If the retrieved data is not a tuble |
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
const emitter = (object, property) => Object.keys(object).find(item => item === property.toString()) ? object[property].map(item => item()): console.log("No match found"); | |
const myInfo = { | |
name: [()=>console.log("My name is Elias"), () => console.log("I am Developer")], | |
fname: [() => console.log("My family name is Rahmani")], | |
age: [() => console.log(`I am ${30}`)] | |
}; | |
emitter(myInfo, "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
const add = (...props) => props.reduce((a,b)=> a+b); | |
const mul = (...props) => props.reduce((a,b)=> a*b); | |
const composer = (f,...rest) => f(...rest); | |
composer(mul, add(1,mul(2,3)), 4); |
I hereby claim:
- I am fractalliter on github.
- I am eliasrahmani (https://keybase.io/eliasrahmani) on keybase.
- I have a public key whose fingerprint is 3A92 4A64 4674 AEFA 904A 883B 0593 126C 54DB 97AA
To claim this, I am signing this object: