diff options
author | neodarz <neodarz@neodarz.net> | 2018-11-27 15:37:48 +0100 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-11-27 15:38:23 +0100 |
commit | 15a404e6a0d95383f02423860a599ad987830424 (patch) | |
tree | 9d436add216637e8da066f6f85611306dfc4ba85 /cheat | |
parent | 8e781f77466eb7ee6b78301042a37b5f61766e70 (diff) | |
download | dotfiles_ascii-15a404e6a0d95383f02423860a599ad987830424.tar.xz dotfiles_ascii-15a404e6a0d95383f02423860a599ad987830424.zip |
Add some cheat
Diffstat (limited to 'cheat')
-rw-r--r-- | cheat/.cheat/RAID | 5 | ||||
-rw-r--r-- | cheat/.cheat/django | 16 | ||||
-rw-r--r-- | cheat/.cheat/django-cms | 9 | ||||
-rw-r--r-- | cheat/.cheat/django-oscar | 17 | ||||
-rw-r--r-- | cheat/.cheat/git | 3 | ||||
-rw-r--r-- | cheat/.cheat/iperf | 1 | ||||
-rw-r--r-- | cheat/.cheat/pdf | 4 | ||||
-rw-r--r-- | cheat/.cheat/phpbrew | 1 | ||||
-rw-r--r-- | cheat/.cheat/ping | 8 | ||||
-rw-r--r-- | cheat/.cheat/pipy | 21 | ||||
-rw-r--r-- | cheat/.cheat/ponghaum | 2 | ||||
-rw-r--r-- | cheat/.cheat/sharing_internet | 44 | ||||
-rw-r--r-- | cheat/.cheat/ssl | 3 | ||||
-rw-r--r-- | cheat/.cheat/su | 5 | ||||
-rw-r--r-- | cheat/.cheat/svg | 5 | ||||
-rw-r--r-- | cheat/.cheat/tmux | 165 | ||||
-rw-r--r-- | cheat/.cheat/vagrant | 37 | ||||
-rw-r--r-- | cheat/.cheat/watch | 2 |
18 files changed, 348 insertions, 0 deletions
diff --git a/cheat/.cheat/RAID b/cheat/.cheat/RAID new file mode 100644 index 0000000..87cc9af --- /dev/null +++ b/cheat/.cheat/RAID @@ -0,0 +1,5 @@ +# Tool for get info on disks +lsscsi + +# If LSILOGIC use: +storcli diff --git a/cheat/.cheat/django b/cheat/.cheat/django new file mode 100644 index 0000000..5771985 --- /dev/null +++ b/cheat/.cheat/django @@ -0,0 +1,16 @@ +# Make a migration +change model in models.py +python manage.py makemigrations +python manage.py migrate + +#Django source code +python -c "import django; print(django.__path__)" + +# Enable virtual env: +mkvirtualenv --python=/usr/bin/python3 oscar + +# Don't forget to install +pip install django + +# Run dev server +python manage.py runserver 127.0.0.1:8000 diff --git a/cheat/.cheat/django-cms b/cheat/.cheat/django-cms new file mode 100644 index 0000000..72770b6 --- /dev/null +++ b/cheat/.cheat/django-cms @@ -0,0 +1,9 @@ +# dep +- python3-dev +- virtualenvwrapper + +mkvirtualenv --python=/usr/bin/python3 oscar + +pip install djangocms-installer + +python manage.py runserver 0.0.0.0:8000 diff --git a/cheat/.cheat/django-oscar b/cheat/.cheat/django-oscar new file mode 100644 index 0000000..a4e00cd --- /dev/null +++ b/cheat/.cheat/django-oscar @@ -0,0 +1,17 @@ +#Dep for stretch: +- libpq-dev +- python3-dev + +# for mkvirtualenv +- virtualenvwrapper + +# DONT FORGET DO UPGRADE PIP !!!! +pip3 install -U setuptools pip + +mkvirtualenv --python=/usr/bin/python3 oscar + +# for pillow +- libjpeg-dev +pip3 install pillow + +sandbox/manage.py runserver 0.0.0.0:8000 diff --git a/cheat/.cheat/git b/cheat/.cheat/git index 9364438..8903fa2 100644 --- a/cheat/.cheat/git +++ b/cheat/.cheat/git @@ -156,3 +156,6 @@ tr -d $'\r' < file_fucked > file_ok # Push to current branch to another branch # Here push local master on remote dreamer_theme git push origin master:dreamer_theme + +# Create bare repo shared +git init --bare --shared=group diff --git a/cheat/.cheat/iperf b/cheat/.cheat/iperf new file mode 100644 index 0000000..5be0952 --- /dev/null +++ b/cheat/.cheat/iperf @@ -0,0 +1 @@ +iperf3 -p 5200 -c ping.online.net ; iperf3 -p 5200 -c ping.online.net -R diff --git a/cheat/.cheat/pdf b/cheat/.cheat/pdf new file mode 100644 index 0000000..6190692 --- /dev/null +++ b/cheat/.cheat/pdf @@ -0,0 +1,4 @@ +# convert to pdf +# security risc : https://bugs.archlinux.org/task/60580 because of https://bugs.archlinux.org/task/59778 +# for enable remove 'PDF' from : /etc/ImageMagick-7/policy.xml +<policy domain="coder" rights="none" pattern="{PS,PS2,PS3,EPS,PDF,XPS}" /> diff --git a/cheat/.cheat/phpbrew b/cheat/.cheat/phpbrew new file mode 100644 index 0000000..cc6f98d --- /dev/null +++ b/cheat/.cheat/phpbrew @@ -0,0 +1 @@ +mcrypt ne fonctionne qu'avec une version de php <= 7.1.x ! diff --git a/cheat/.cheat/ping b/cheat/.cheat/ping new file mode 100644 index 0000000..a50198b --- /dev/null +++ b/cheat/.cheat/ping @@ -0,0 +1,8 @@ +# ping a host with a total count of 15 packets overall. +ping -c 15 www.example.com + +# ping a host with a total count of 15 packets overall, one every .5 seconds (faster ping). +ping -c 15 -i .5 www.example.com + +# test if a packet size of 1500 bytes is supported (to check the MTU for example) +ping -s 1500 -c 10 -M do www.example.com diff --git a/cheat/.cheat/pipy b/cheat/.cheat/pipy new file mode 100644 index 0000000..e9744fb --- /dev/null +++ b/cheat/.cheat/pipy @@ -0,0 +1,21 @@ +# Fist check if pbr package is installed (if use tag for set version) +pip install pbr + +# Install necessary package for compil +python -m pip install --user --upgrade setuptools wheel + +# Build the package +python setup.py sdist bdist_wheel + +# For upload install necessary package +pip install twine + +# upload new version of a package +pip install artedv_dl + +# upload on test server +twine upload --repository-url https://test.pypi.org/legacy/ dist/* + +# install from test server +python3 -m pip install --index-url https://test.pypi.org/simple/ example_pkg + diff --git a/cheat/.cheat/ponghaum b/cheat/.cheat/ponghaum new file mode 100644 index 0000000..98d9884 --- /dev/null +++ b/cheat/.cheat/ponghaum @@ -0,0 +1,2 @@ +sudo socat /dev/ttyACM0,b115200 - | tee /tmp/a | ./livehex +tail -f /tmp/a diff --git a/cheat/.cheat/sharing_internet b/cheat/.cheat/sharing_internet new file mode 100644 index 0000000..8dca3b5 --- /dev/null +++ b/cheat/.cheat/sharing_internet @@ -0,0 +1,44 @@ +# First connect machines ! + +# Enable port fowrading +sysctl net.ipv4.ip_forward=1 + +# fowrwarding Wifi -> Ethernet +iptables -t nat -A POSTROUTING -o internet0 -j MASQUERADE +iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +iptables -A FORWARD -i net0 -o internet0 -j ACCEPT + +# First setup of device +sudo ip link set up dev enp0s25 +sudo ip addr add 192.168.2.100/24 dev enp0s25 # arbitrary address + +# /etc/dhcpd.conf +option domain-name-servers 80.67.169.12, 80.67.169.40; +option subnet-mask 255.255.255.0; +option routers 192.168.4.100; +subnet 192.168.4.0 netmask 255.255.255.0 { + range 192.168.4.150 192.168.4.250; + + host fenec { + hardware ethernet 5c:ff:35:09:ac:6a; + fixed-address 192.168.4.100; + } + +} + +# Service +# /etc/systemd/system/dhcpd4@.service +[Unit] +Description=IPv4 DHCP server on %I +Wants=network.target +After=network.target + +[Service] +Type=forking +PIDFile=/run/dhcpd4.pid +ExecStart=/usr/bin/dhcpd -4 -q -pf /run/dhcpd4.pid %I +KillSignal=SIGINT + +[Install] +WantedBy=multi-user.target + diff --git a/cheat/.cheat/ssl b/cheat/.cheat/ssl new file mode 100644 index 0000000..f89777e --- /dev/null +++ b/cheat/.cheat/ssl @@ -0,0 +1,3 @@ +echo | openssl s_client -servername NAME -connect HOST:PORT 2>/dev/null | openssl x509 -noout -dates + +https://www.shellhacks.com/openssl-check-ssl-certificate-expiration-date/ diff --git a/cheat/.cheat/su b/cheat/.cheat/su new file mode 100644 index 0000000..06799c0 --- /dev/null +++ b/cheat/.cheat/su @@ -0,0 +1,5 @@ +# Switch to another user account +su USERNAME + +# Login to an account with special shell +su - <user> -s /bin/bash diff --git a/cheat/.cheat/svg b/cheat/.cheat/svg new file mode 100644 index 0000000..baa48da --- /dev/null +++ b/cheat/.cheat/svg @@ -0,0 +1,5 @@ +# CSS + +`background-image: url("data:image/svg+xml;charset=utf8,<svg [...]");` + +Don't use `#` but `%23`. diff --git a/cheat/.cheat/tmux b/cheat/.cheat/tmux new file mode 100644 index 0000000..161e4ff --- /dev/null +++ b/cheat/.cheat/tmux @@ -0,0 +1,165 @@ +# Start tmux: +tmux + +# Prefix == Ctrl-b or Ctrl-w + +# Detach from tmux: +Prefix d + +# Restore tmux session: +tmux attach + +# Detach an already attached session (great if you are moving devices with different screen resolutions) +tmux attach -d + +# Display session: +tmux ls + +# Rename session: +Prefix $ + +# Switch session: +Prefix s + +# Start a shared session: +tmux -S /tmp/your_shared_session +chmod 777 /tmp/your_shared_session + +# Help screen (Q to quit): +Prefix ? + +# Scroll in window: +Prefix PageUp/PageDown + +# Reload configuation file +Prefix : source-file /path/to/file + +# lauch command +Prefix : + +# Zoom in tab +Prefix z + +# Open pane in the current directory (alias configured) +# Vertical +Prefix _ +# Horizontal +Prefix / + +# Toggle recording terminal into a file +Prefix P + +# Window management +# ================= + +# Create window: +Prefix c + +# Destroy window: +Prefix & + +# Switch between windows: +Prefix [0-9] +or +Prefix Arrows + +# Split windows horizontally: +Prefix % + +# Split windows vertically: +Prefix " + +# Turn a pane into a Window +Prefix ! + +# Pane management +# =============== + +# kill pane +Prefix x + +# Buffer with vim keys +# ==================== + +# jump to next word +w + +# jump back one word +b + +# jump to the next character +f <char> + +# move one page up +Ctrl-b + +# move one page down +Ctrl-f + +# Search in buffer (use <n> and <N>) +? + +# For search downward +/ + +# Select some text +# Use <Enter> to quit and copy selected text in buffer +space + +# paste content captured +Prefix ] + +# commands +# ======== + +# Copy the entire visible contents pane to the paste buffer +capture-pane + +# show the content of the paste buffer +show-buffer + +# list all pasted buffer +list-buffers + +# Choos a buffer and past +choose-buffer + +# Turn Window into a pane, take window of a session and join it to the current +# session +join-pane <session_name>:<window_id> + +# Mouve pane to another window +join-pane -s <session_name>:<window_id>.<pane_id> + +# Move pane from pane to another +join-pane -s <session_name>:<window_id>.<pane_id> <session_name>:<window_id> + +# Move window between sessions +move-window -s <session_name>:<session_id> -t <session_id> + +# Multi user +# ========== + +# For use multi user you must make different session for have habilty to +# seperate window + +# first create a simple session +tmux new-session -s groupedsession + +# And connect to it with another session +tmux new-session -t groupedsession -s mysession + +# Session management +# ================== + +# Switch between session +# Go to previous section +Prefix ( +# Go to next section +Prefix ) + +# Display list of sessions +Prefix s + +# Move window betweeb sessions +Prefix . <session_name> diff --git a/cheat/.cheat/vagrant b/cheat/.cheat/vagrant new file mode 100644 index 0000000..8c0b6c0 --- /dev/null +++ b/cheat/.cheat/vagrant @@ -0,0 +1,37 @@ +# Initate Vagrant +mkdir vag-vm; cd vag-vm +vagrant init + +# Add a box to vagrant repo +vagrant box add hashicorp/precise32 + +# Add a box Vagrant file +config.vm.box = "hashicorp/precise32" + +# Add vm to public network as host +config.vm.network "public_network" + +# Add provision script to vagrant file +config.vm.provision :shell, path: "provision.sh" + +# Start vm +vagrant up + +# Connect to started instance +vagrant ssh + +# Shutdown vm +vagrant halt + +# Hibernate vm +vagrant suspend + +# Set vm to initial state by cleaning all data +vagrant destroy + +# Restart vm with new provision script +vagran reload --provision + +# List status of each VM +# --prune invalid entries from the list. This is much more time consuming than simply listing the entries. +vagrant global-status --prune diff --git a/cheat/.cheat/watch b/cheat/.cheat/watch new file mode 100644 index 0000000..87afe8d --- /dev/null +++ b/cheat/.cheat/watch @@ -0,0 +1,2 @@ +# For watch size of directory +ls -alh cd.backup | tail -1 | awk '{print $(NF-5),"\t",$(NF)}' |