Page MenuHomeDevCentral

D2954.id7519.diff
No OneTemporary

D2954.id7519.diff

diff --git a/.arcconfig b/.arcconfig
new file mode 100644
--- /dev/null
+++ b/.arcconfig
@@ -0,0 +1,5 @@
+{
+ "phabricator.uri": "https://devcentral.nasqueron.org",
+ "repository.callsign": "SNIPPETS"
+}
+
diff --git a/.arclint b/.arclint
new file mode 100644
--- /dev/null
+++ b/.arclint
@@ -0,0 +1,10 @@
+{
+ "linters": {
+ "chmod": {
+ "type": "chmod"
+ },
+ "filename": {
+ "type": "filename"
+ }
+ }
+}
diff --git a/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,39 @@
+## Snippets
+
+Those snippets can be used as starting block for applications
+and configuration files.
+
+They're general purpose and can be used for any project,
+but headers and codestyle are customized for Nasqueron.
+
+### Tips
+
+Trailing spaces have been added when you need to add informtation,
+you can start immediately after the last space. This method allows
+you to check with `git diff` if all has been filed: the UI will highlight
+any trailing space, so it means you forgot to add information there.
+
+Beware when committing changes NOT to remove those trailing spaces.
+
+### Snippets or library?
+
+If code belongs to a library, it's probably best to create or improve
+one of our core libraries, like:
+
+ - Limiting Factor: Rust helper methods to build API
+ - Keruald Omnitools: PHP utilities library
+
+### License
+
+Any snippet should be trivial enough not to be eligible to copyright.
+
+If eligible, the person who associated a work with this deed has dedicated the
+work to the public domain by waiving all of her rights to the work worldwide
+under copyright law, including all related and neighboring rights, to the
+extent allowed by law, using the CC0 1.0 Universal Public Domain Dedication.
+
+CC0 1.0 Universal Public Domain Dedication
+https://creativecommons.org/publicdomain/zero/1.0/
+
+Note: the "LICENSE" file in the doc/ folder is intended to be copied
+for projects needing a license, and isn't the license for this repository.
diff --git a/doc/LICENSE b/doc/LICENSE
new file mode 100644
--- /dev/null
+++ b/doc/LICENSE
@@ -0,0 +1,24 @@
+Copyright 2023 Nasqueron
+
+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.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/python/command.py b/python/command.py
new file mode 100755
--- /dev/null
+++ b/python/command.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+# -------------------------------------------------------------
+#
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Description:
+# License: BSD-2-Clause
+# -------------------------------------------------------------
+
+
+import os
+import sys
+
+
+# -------------------------------------------------------------
+# Application entry point
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def run(foo):
+ pass
+
+
+if __name__ == "__main__":
+ argc = len(sys.argv)
+
+ if argc < 2:
+ print(f"Usage: {sys.argv[0]} <foo>", file=sys.stderr)
+ sys.exit(1)
+
+ run(sys.argv[1])
diff --git a/salt/file-point-virgule.conf b/salt/file-point-virgule.conf
new file mode 100644
--- /dev/null
+++ b/salt/file-point-virgule.conf
@@ -0,0 +1,14 @@
+; -------------------------------------------------------------
+;
+; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+; Project:
+; License: Trivial work, not eligible to copyright
+; Source file:
+; -------------------------------------------------------------
+;
+; <auto-generated>
+; This file is managed by our rOPS SaltStack repository.
+;
+; Changes to this file may cause incorrect behavior
+; and will be lost if the state is redeployed.
+; </auto-generated>
diff --git a/salt/file.conf b/salt/file.conf
new file mode 100644
--- /dev/null
+++ b/salt/file.conf
@@ -0,0 +1,18 @@
+# -------------------------------------------------------------
+#
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file:
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# -------------------------------------------------------------
+#
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/shell/is-user-root.sh b/shell/is-user-root.sh
new file mode 100644
--- /dev/null
+++ b/shell/is-user-root.sh
@@ -0,0 +1,10 @@
+# -------------------------------------------------------------
+# Ensure user is root
+#
+# Note: POSIX shells don't always define $UID or $EUID.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ "${EUID:-$(id -u)}" -ne 0 ]; then
+ echo "This command must be run as root." >&2
+ exit 1
+fi
diff --git a/shell/script.sh b/shell/script.sh
new file mode 100755
--- /dev/null
+++ b/shell/script.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+#
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: BSD-2-Clause
+# -------------------------------------------------------------
+
+set -e
+
+# -------------------------------------------------------------
+# Parse arguments
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ $# -eq 0 ]; then
+ echo "Usage: $(basename $0) <foo>" >&2
+ exit 1
+fi
+
+FOO=$1
+
+# -------------------------------------------------------------
+#
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 13:36 (20 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2314017
Default Alt Text
D2954.id7519.diff (6 KB)

Event Timeline