git branch -m <old> <new>
Create verified commits
#gpg #git #hithub
- Install GPG Suite from https://gpgtools.org
- Generate a new gpg key with GPG Keychain
- Save the public key somewhere you will find it!
- Add the public key to gitHub:
- navigate to https://github.com/settings/keys
- select New GPG Key
- Copy and paste the public key block; → begins with:
-----BEGIN PGP PUBLIC KEY BLOCK-----
- Tell git to sign commits
- Fire up a local terminal
- find the key ID of the previously generated Key
% gpg --list-secret-keys --keyid-format=long
- From the list of GPG keys, copy the long form of the GPG key ID for the pubkic key you've added to gitHub. The GPG key ID looks something like
3CC7D39017658BD1
→ see this example:
% gpg --list-secret-keys --keyid-format=long /Users/exampleuser/.gnupg/pubring.kbx ------------------------------------ sec rsa4096/3CC7D39017658BD1 2023-06-25 [SC] BD2D9C59394D7F4F8680DEB80FA94B9E0B5C93C0 uid [ultimate] github <[email protected]> ssb rsa4096/CC50DC7499FF0A21 2023-06-25 [E]
- Set the GPG signing key ID in Git; In this example, the GPG key ID is
3CC7D39017658BD1
:
% git config --global user.signingkey 3CC7D39017658BD1
- [optional] Configure Git to sign all commits by default:
% git config --global commit.gpgsign true
git fetch origin
fetches all remote branches available
% git branch -v -a
shows all branches ready to checkout
→ checkout remote branch like:
% git checkout -b <branchname> origin/<branchname>
-
Add remote repo:
% git remote add <repo name (best practise: origin)> <remote repository url>
-
get remote repository origin url:
% git remote get-url origin
-
change remote repository:
% git remote set-url origin <remote repository url>
-
update forked repository: (the circuitous way)
git remote add upstream <REPO-URL> git fetch upstream git checkout <BRANCH> git reset --hard upstream/<BRANCH> git push origin <BRANCH> --force
- Alt1:
git config --system core.longpaths true`
- Admin rights may be required
- Alt2: open C:\Program Files\Git\etc\gitconfig → under
[core]
addlongpaths = true
- Admin rights may be required.
% git log --oneline
find commit hash to check out
% git checkout <commit-hash>
log commit hash only:
git log --oneline
-
start db server:
- Environment Variable PGDATA festlegen (default [WINDOWS]: C:\Program Files\PostgreSQL\14\data)
pg_ctl start -l logfile (startet db server im Hintergrung und schreibt loggs in "logfile")
-
stop db server:
pg_ctl stop
-
check if running [WINDOWS]:
- Alt1:
- WIN+R
services.msc
- look for postgresql-[version]
- Alt2:
- fire up a terminal
pg_ctl status
- Alt1:
-
change pw:
psql -U <username> postgres=# \password <username> Enter new password: <new-password> postgres=# \q
#openssl #rsa #ed25519 #ssl
- generate private rsa key [stores the private key in the current directory]
% openssl genrsa -out <private key name> <size in bytes>
- generate public key
% openssl rsa -in <private key name> -pubout -outform <output format (e.g. PEM)> -out <private key name>
Notes
- documentation (POSIX)
% man openssl
#binance test net
- generate private ed25519 key [stores the private key in the current directory]
% openssl genpkey -algorithm ed25519 -out <private key name>
- generate public key
% openssl pkey -pubout -in <private key name> -out <public key name>
Notes
- Useful Links:
#ssh #encryption #encoding #POSIX #github
- generate ssh key pair (example)
% ssh-keygen -t rsa -b 4096 -f <keyname>
- [optional] convert key format (example) → e.g., to use rsa public key with PKCS8 format
% ssh-keygen -f <keyname>.pub -e -m PKCS8 > <converted filename>
Notes:
- Addition to 1.: If switch
-f <keyname>
is provided, the keypair will be saved to~/.ssh
esle you'll be prompted to specify a location and filename.~/.ssh
resolves to/Users/<user>/.ssh/
- documentation (POSIX)
% man ssh-keygen
- Useful Links:
#binance
- generate ssh key pair (this only formats the private key with the PKCS#8 format) (example)
% ssh-keygen -t rsa -b 4096 -m PKCS8 -f <keyname>
- convert public key to PKCS#8 format (example)
% ssh-keygen -f <keyname>.pub -e -m PKCS8 > <converted filename>
Notes:
- Visit https://testnet.binance.vision/
- Log in with GitHub (GitHub account required)
- Locally generate key pair (rsa between 2048 and 4096 byte or ed25519)
- registr public key
% eval "$(ssh-agent)"
% ssh-add path/to/private_key
% eval `ssh-agent`
% ssh-add path/to/private_key
Pagebreak for generated PDFs:
wrap the section that shall be on a new Page in:
<div style="page-break-after: always;">
Business as usual
</div>
Action | Shortcut | Version |
---|---|---|
Emoji Keyboard | WINDOWS + . |
10 or newer |
- Alternative name for a command:
- create a *.bat file
-
@echo off set "NEW_COMMAND_NAME=C:\path\to\COMMAND_EXECUTABLE" %NEW_COMMAND_NAME% %*
- The
%NEW_COMMAND_NAME% %*
line executes the Maven command stored in theNEW_COMMAND_NAME
variable, and%*
passes any additional arguments to the executable. - To find out where the executable is, run
where <executable>
- The
- include the directory where your *.bat is located in your (user-level)
PATH
variable. - Use the new command:
new-command-name
in any Command Prompt.
Action | Shortcut |
---|---|
Comment | CTRL + K, CTRL + C |
Uncomment | CTRL + K, CTRL + U |
Collapse all methods | CTRL + M, CTRL + O |
Expand all methods | CTRL + M, CTRL + P |
Collapse/expand selection | CTRL + M, CTRL + M |
- place cursor (caret) on class definition
CTRL + .
- Select "Generate Equals and GetHashCode..."
Java | C# | Java Example | C# example |
---|---|---|---|
Collection.forEach(<lambda>) |
Enumerable.ForEach(<lambda>) |
List<String> strings = new ArrayList<>();
strings.add("demo");
strings.add("list");
strings.add("of");
strings.add("strings");
// Print list entries
strings.forEach(System.out::println); |
List<string> strings = new List<string>
{
"demo", "list", "of", "strings"
};
// Print list entries
strings.ForEach(Console.WriteLine) |
Collection.stream().map(<lambda>) |
Enumerable.Select(<lambda>) |
List<String> strings = new ArrayList<>();
strings.add("demo");
strings.add("list");
strings.add("of");
strings.add("strings");
// convert entries to upper case
List<String> converted = strings.stream()
.map(str -> str.toUpperCase());
.collect(Collectors.toList()); |
List<string> strings = new List<string>
{
"demo", "list", "of", "strings"
};
// convert entries to upper case
List<string> converted = strings
.Select(str => str.ToUpper())
.ToList(); |
Collection.stream().filter(<lambda>) |
Enumerable.Where(<lambda>) |
List<String> strings = new ArrayList<>();
strings.add("demo");
strings.add("list");
strings.add("of");
strings.add("strings");
// filter for entries containing the letter 'i'
List<String> filtered = strings.stream()
.filter(str -> str.contains("i"));
.collect(Collectors.toList()); // -> [list, strings] |
List<string> strings = new List<string>
{
"demo", "list", "of", "strings"
};
// filter for entries containing the letter 'i'
List<string> filtered = strings
.Where(str => str.Contains("i"))
.ToList(); // -> [list, strings] |
Collection.stream().takeWhile(<lambda>) |
Enumerable.TakeWhile(<lambda>) |
List<Integer> numbers = new ArrayList<>();
numbers.add(1);
numbers.add(2);
numbers.add(3);
// take while number n == first entry or n is even
List<Integer> takenNumbers = numbers.stream()
.takeWhile(n -> n.equals(numbers.get(0)) || n % 2 == 0)
.collect(Collectors.toList()); // -> [1, 2] |
List<int> numbers = new List<int> { 1, 2, 3 };
// take while number n == first entry or n is even
List<int> takenNumbers = numbers
.TakeWhile((n, index) => index == 0 || n % 2 == 0)
.ToList(); // -> [1, 2] |
# mongo
> show dbs
> use <whatever db>
> db.getCollectionNames().forEach(function(c) { if(c.indexOf("system.") == -1) db.getCollection(c).drop(); })
> quit()
# mvn dependency:analyze
Action | shortcut | Note |
---|---|---|
Reveal Element in Project Browser | Alt + G |
Element (E.g. on diagram) must be selected |
Reveal Diagram in Project Browser (from open diagram) | SHIFT + Alt + G |
|
Edit Element Attributes | F9 |
Element must be selected (especially useful with class/interface Elements) |
Open Element Properties | Alt + ENTER |
Element must be selectred |
Rename Element | F2 |
Element must be selected |
Show Toolbox | Alt + 5 |
Diagram must be opened |
Right-click on the background of open diagram → Toggle Lock Diagram
-
Navigate to 'Find in Project' (Press
Strg + F
or navigateStart Ribbon > Search > Search in Model
)
-
Define SQL queries
a. Create a new Search
b. Give it a name
c. Select "SQL Editor"
d. Write Sql Queries
d.1. If SQL Editor doesn't show up: press the "note-with-pen"-Symbol
-
[Exkurs] "popular" tables
content table_name Diagramms t_diagram
Architecture Elements t_object
Packages/Directories t_package
NOTE: The database schema is poorly documented but the SQL-Editor has code compleation, which can give useful hints on which tables and columns are available. It can be triggered pressing
Strg + SPACE
-
Query pattern for Results linked with the corresponding element in the model
SELECT <table_name>.ea_guid AS CLASSGUID, <table_name>.<table_type> AS CLASSTYPE [, '<table_name>' AS CLASSTABLE] ...
-
Example: Query to find unagreed sequence diagrams (BorgWarner Porsche eTurbo specific)
SELECT t_diagram.ea_guid AS CLASSGUID, 't_diagram' as CLASSTABLE, t_diagram.Diagram_Type AS CLASSTYPE, t_diagram.Name as Name, t_diagram.Diagram_Type as Type, t_package.Name AS Pkg FROM t_diagram, t_package WHERE (t_diagram.Package_ID = t_package.Package_ID) AND t_diagram.Diagram_Type LIKE "sequence" AND t_diagram.Version NOT LIKE '*agreed*'
- Open the Diagram to be Reviewed
- Use the "Review" Artifact from the Toolbox pane for review remarks
2.1 If toolbox pane is not visible, reveal it withAlt + 5
or find it withinDesign Ribbon > Diagram > Toolbox
- [Edge case] Review Items that are not on a Diagram:
3.1 Use (or create) a random Diagram that is in the same package as the item to be reviewed.
3.2 Create a Review Artifact as described above
3.3 Carry out the review as usual
3.4 Delete the Review Artifact from the diagram → it will still remain in the package
(3.5 if a new "helper diagram" has been created for this purpose, it can be deleted)
- Open a previous (baseline) verison to compare with in EA
- Navigate to
Publish Ribbon > Model Exchange > Export XMI > Export XMI...
a. Chose a package to export (Caution, exporting the entire model may be time consuming)
b. Chose an appropriate location and name
c. Select the corresponding XMI Type (For EA 13.5 it is XMI1.1, [Note] The required version will be determined at the latest when the comparison is about to be made.)
d. Hit Export
- Now open the current version in EA
- Navigate to
Publish Ribbon > Model Exchange > Package Control > Compare Package to XMI
- Import the previously exported (Step 2) xml file (If the entire model was exportet in Step 2 this will be time consuming) [Note] If a incompatible XMI Version was used now a warning with a pointer to the correct version would appear → in this case go back to step 2 and re-export the baseline with the correct XMI version
- On the left side all changed files are to be found; on the right-hand side, the changes are displayed in a table. the current version is in the left-hand column, the baseline version is in the right-hand column.
- Using the "Reviews-Section" (prefered way)
1.1 Navigate toStart Ribbon > Today > Reviews > Manage Reviews
1.2 To reveal the review Artifact in diagram or project browser:right click
→ select the appropriate - Using SQL to find diagrams with Review Items:
DISCLAIMER: The following finds diarams with Review Elements. There may be Review Elements that are not on a Diagram. To find these the query must be adjusted.
SELECT
t_diagram.ea_guid AS CLASSGUID,
't_diagram' as CLASSTABLE,
t_diagram.Diagram_Type AS CLASSTYPE
t_diagram.Name AS [Name],
t_diagram.Diagram_Type AS [Type],
t_diagram.Author, t_diagram.Version,
t_diagram.ModifiedDate
FROM
t_diagram, t_object, t_diagramobjects
WHERE
t_diagram.Diagram_ID = t_diagramobjects.Diagram_ID
AND t_diagramobjects.Object_ID = t_object.Object_ID
AND t_object.Stereotype = "EAReview"
AND NOT t_diagram.Diagram_Type = 'Custom'
Normalization (according to [Video])
- Normal Form (1NF)
- Using row order to convey Information violates 1NF!
- Be Explicite! -> introduce Columns that can be used to sort the data in the expected way!
- Only one datatype per column!
zsh: run
chsh -s /bin/zsh
.
restart shell
bash: run
chsh -s /bin/bash
.
restart shell
SQL | AQL |
---|---|
INSERT INTO users |
INSERT |
SELECT * |
FOR user IN users |
SELECT name |
FOR user IN users |
SELECT name |
FOR user IN users |
UPDATE users |
UPDATE { _key: "1" } |
DELETE FROM users |
FOR user IN users |