- Diesel CLI : Familiarise with Diesel's command-line tools for managing projects and migrations.
- Migrations: Understand managing database schema changes over time with Diesel's ]LI.
- Schema Management: Learn how Diesel uses
schema.rs
and thetable!
macro to reflect database structures. - Type Safety and Conversion : Grasp how Rust types correspond to SQL types and handling custom types.
- Query Builder: Learn to construct SQL queries using Rust, utilising methods like
filter
,order
, andlimit
- CRUD Operations: Understand how to perform create, read, update, and delete operations using Diesel.
- Connection Handling: Learn about managing database connections, executing queries, and handling transactions.
- Associations and Joins: (TODO) Learn about expressing r
This document provides a comprehensive guide on using the tracing::instrument
macro in Rust. It covers the basics of the tracing
crate, the purpose and functioning of the instrument
macro, and best practices for its effective use in software development.
-
Overview: The
tracing
crate is a collection of Rust libraries for application-level tracing and asynchronous diagnostics. It provides a framework for collecting structured, event-based diagnostic information. Theinstrument
macro, specifically, is a part of this crate. It automatically attaches context-specific information to logs, such as function arguments and return values, making it easier to track the flow and performance of the code. -
Purpose: The primary purpose of the
tracing::instrument
macro is to aid in diagnostics and performance analysis. By annotating functions with this macro, developers can automatic
#!/bin/bash | |
# Use nmap to find open ports fast and then run a detailed scans on the returned ports | |
if [ -z "$1" ] | |
then | |
echo "__nmap_fast__" | |
echo "Usage: ./nmap_fast TARGET_HOSTNAME" | |
fi | |
TARGET_HOSTNAME=$1 |
## Encrypt | |
tar cz folder | openssl aes-256-cbc -salt -pbkdf2 -e > out.tar.gz.enc | |
## Decrypt | |
openssl aes-256-cbc -d -salt -pbkdf2 -in out.tar.gz.enc | tar xz |
#!/bin/bash | |
set -e | |
sudo -u ec2-user -i <<'EOF' | |
conda create --prefix ~/your_project -y -c conda-forge python=3.7 ipykernel | |
source activate /home/ec2-user/your_project | |
conda install -y your_libs | |
python -m ipykernel install --user |
binary_search(){ | |
TARGET=$1 | |
TO_SEARCH=(${@:2}) | |
LENGTH=${#TO_SEARCH[@]} | |
START=0 | |
END=$((LENGTH - 1)) | |
while [[ $START -le $END ]]; do | |
MIDDLE=$((START + ((END - START)/2))) | |
ITEM_AT_MIDDLE=${TO_SEARCH[MIDDLE]} |
#!/bin/bash | |
ME=`whoami` | |
PROCESS=$1 | |
echo $PROCESS | |
echo $ME | |
IPCS_S=`ipcs -s $PROCESS | egrep "0x[0-9a-f]+0-9]+" | grep $ME | cut -f2 -d" "` | |
IPCS_M=`ipcs -m $PROCESS | egrep "0x[0-9a-f]+[0-9]+" | grep $ME | cut -f2 -d" "` |
#expose yam facts under /var/lib/puppet/yaml/facts/ in /etc/puppet/fileserver.conf and access via http | |
curl -k -H "Accept: yaml" https://puppetmaster:8140/production/facts/hostname |
require 'puppet' | |
require 'puppet/application' | |
require 'facter' | |
typeobj = Puppet::Type.type("package") | |
properties = typeobj.properties.collect { |s| s.name } | |
format = proc {|trans| | |
trans.dup.collect do |param, value| | |
if value.nil? or value.to_s.empty? | |
trans.delete(param) |
#!/bin/sh -x | |
## REST API JIRA KEY check | |
#List of projects that do not require strict JIRA KEY commits | |
#list in space and case-insensitive | |
NON_STRICT="sports" | |
# Authentication credentials | |
username=root |