more content
parent
17d2cc06d7
commit
2d2d0744a0
9 changed files with 407 additions and 0 deletions
36
Bash-Dump-History.md
Normal file
36
Bash-Dump-History.md
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
Using `gdb` to trigger the internal bash function to write out it's history still in memory but not on disk
|
||||
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Given the PID of an active bash process, dump it's history
|
||||
# using gdb and the function within bash named write_history()
|
||||
# to a temp file.
|
||||
|
||||
# Input is the running PID of the bash process to dump
|
||||
BPID=$1
|
||||
|
||||
gdb --batch --eval "attach ${BPID}" \
|
||||
--eval "call (int)write_history(\"/tmp/bash_history-${BPID}.txt\")" \
|
||||
--eval 'detach' --eval 'q'
|
||||
|
||||
echo "Wrote /tmp/bash_history-${BPID}.txt"
|
||||
|
||||
# example:
|
||||
# ./dump_bash_history.sh 1019
|
||||
# 0x00007f80483e506b in waitpid () from /usr/lib/libc.so.6
|
||||
# $1 = 0
|
||||
# [Inferior 1 (process 1019) detached]
|
||||
# Wrote /tmp/bash_history-1019.txt
|
||||
|
||||
# http://git.savannah.gnu.org/cgit/bash.git/tree/lib/readline/histfile.c#n784
|
||||
# /* Overwrite FILENAME with the current history. If FILENAME is NULL,
|
||||
# then write the history list to ~/.history. Values returned
|
||||
# are as in read_history ().*/
|
||||
# int
|
||||
# write_history (const char *filename)
|
||||
# {
|
||||
# return (history_do_write (filename, history_length, HISTORY_OVERWRITE));
|
||||
# }
|
||||
```
|
||||
|
||||
155
CSS-Reset.md
Normal file
155
CSS-Reset.md
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
CSS block to force a reset of all elements
|
||||
|
||||
```
|
||||
.reset-this {
|
||||
animation : none;
|
||||
animation-delay : 0;
|
||||
animation-direction : normal;
|
||||
animation-duration : 0;
|
||||
animation-fill-mode : none;
|
||||
animation-iteration-count : 1;
|
||||
animation-name : none;
|
||||
animation-play-state : running;
|
||||
animation-timing-function : ease;
|
||||
backface-visibility : visible;
|
||||
background : 0;
|
||||
background-attachment : scroll;
|
||||
background-clip : border-box;
|
||||
background-color : transparent;
|
||||
background-image : none;
|
||||
background-origin : padding-box;
|
||||
background-position : 0 0;
|
||||
background-position-x : 0;
|
||||
background-position-y : 0;
|
||||
background-repeat : repeat;
|
||||
background-size : auto auto;
|
||||
border : 0;
|
||||
border-style : none;
|
||||
border-width : medium;
|
||||
border-color : inherit;
|
||||
border-bottom : 0;
|
||||
border-bottom-color : inherit;
|
||||
border-bottom-left-radius : 0;
|
||||
border-bottom-right-radius : 0;
|
||||
border-bottom-style : none;
|
||||
border-bottom-width : medium;
|
||||
border-collapse : separate;
|
||||
border-image : none;
|
||||
border-left : 0;
|
||||
border-left-color : inherit;
|
||||
border-left-style : none;
|
||||
border-left-width : medium;
|
||||
border-radius : 0;
|
||||
border-right : 0;
|
||||
border-right-color : inherit;
|
||||
border-right-style : none;
|
||||
border-right-width : medium;
|
||||
border-spacing : 0;
|
||||
border-top : 0;
|
||||
border-top-color : inherit;
|
||||
border-top-left-radius : 0;
|
||||
border-top-right-radius : 0;
|
||||
border-top-style : none;
|
||||
border-top-width : medium;
|
||||
bottom : auto;
|
||||
box-shadow : none;
|
||||
box-sizing : content-box;
|
||||
caption-side : top;
|
||||
clear : none;
|
||||
clip : auto;
|
||||
color : inherit;
|
||||
columns : auto;
|
||||
column-count : auto;
|
||||
column-fill : balance;
|
||||
column-gap : normal;
|
||||
column-rule : medium none currentColor;
|
||||
column-rule-color : currentColor;
|
||||
column-rule-style : none;
|
||||
column-rule-width : none;
|
||||
column-span : 1;
|
||||
column-width : auto;
|
||||
content : normal;
|
||||
counter-increment : none;
|
||||
counter-reset : none;
|
||||
cursor : auto;
|
||||
direction : ltr;
|
||||
display : inline;
|
||||
empty-cells : show;
|
||||
float : none;
|
||||
font : normal;
|
||||
font-family : inherit;
|
||||
font-size : medium;
|
||||
font-style : normal;
|
||||
font-variant : normal;
|
||||
font-weight : normal;
|
||||
height : auto;
|
||||
hyphens : none;
|
||||
left : auto;
|
||||
letter-spacing : normal;
|
||||
line-height : normal;
|
||||
list-style : none;
|
||||
list-style-image : none;
|
||||
list-style-position : outside;
|
||||
list-style-type : disc;
|
||||
margin : 0;
|
||||
margin-bottom : 0;
|
||||
margin-left : 0;
|
||||
margin-right : 0;
|
||||
margin-top : 0;
|
||||
max-height : none;
|
||||
max-width : none;
|
||||
min-height : 0;
|
||||
min-width : 0;
|
||||
opacity : 1;
|
||||
orphans : 0;
|
||||
outline : 0;
|
||||
outline-color : invert;
|
||||
outline-style : none;
|
||||
outline-width : medium;
|
||||
overflow : visible;
|
||||
overflow-x : visible;
|
||||
overflow-y : visible;
|
||||
padding : 0;
|
||||
padding-bottom : 0;
|
||||
padding-left : 0;
|
||||
padding-right : 0;
|
||||
padding-top : 0;
|
||||
page-break-after : auto;
|
||||
page-break-before : auto;
|
||||
page-break-inside : auto;
|
||||
perspective : none;
|
||||
perspective-origin : 50% 50%;
|
||||
position : static;
|
||||
/* May need to alter quotes for different locales (e.g fr) */
|
||||
quotes : '\201C' '\201D' '\2018' '\2019';
|
||||
right : auto;
|
||||
tab-size : 8;
|
||||
table-layout : auto;
|
||||
text-align : inherit;
|
||||
text-align-last : auto;
|
||||
text-decoration : none;
|
||||
text-decoration-color : inherit;
|
||||
text-decoration-line : none;
|
||||
text-decoration-style : solid;
|
||||
text-indent : 0;
|
||||
text-shadow : none;
|
||||
text-transform : none;
|
||||
top : auto;
|
||||
transform : none;
|
||||
transform-style : flat;
|
||||
transition : none;
|
||||
transition-delay : 0s;
|
||||
transition-duration : 0s;
|
||||
transition-property : none;
|
||||
transition-timing-function : ease;
|
||||
unicode-bidi : normal;
|
||||
vertical-align : baseline;
|
||||
visibility : visible;
|
||||
white-space : normal;
|
||||
widows : 0;
|
||||
width : auto;
|
||||
word-spacing : normal;
|
||||
z-index : auto;
|
||||
}
|
||||
```
|
||||
|
||||
84
Git-Quickstart.md
Normal file
84
Git-Quickstart.md
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
Quick and dirty git contributing to a random project
|
||||
|
||||
```
|
||||
# fork the project to your personal space on the webUI
|
||||
<web fork>
|
||||
|
||||
# pull down your working copy from your fork, then connect it to the project
|
||||
# - "origin" is the accepted name for you / your forks
|
||||
# - "upstream" is the accepted name for master projects
|
||||
git clone git@<GIT URL>:<ME>/<project>.git
|
||||
cd <project dir>
|
||||
git remote add upstream git@<GIT URL>:<UPSTREAM>/<project>.git
|
||||
|
||||
# configure your working fork, required for commits
|
||||
git config user.name <my name>
|
||||
git config user.email <my email>
|
||||
|
||||
# switch to the project working branch where you base changes off of
|
||||
# - you connect it to *your* working copy of the branch, *not* upstream
|
||||
# - track it for changes, will be used when syncing your fork later
|
||||
git checkout --track origin/devel
|
||||
|
||||
# now make your new branch to edit code n stuff
|
||||
# - defaults to branching from current point, origin/devel in this example
|
||||
# - different source point can be named, just add to end of command
|
||||
git checkout -b <my new branch>
|
||||
|
||||
<edits and things>
|
||||
|
||||
# commit your local edits to your local working copy
|
||||
git add file/name.py CHANGELOG.md ...
|
||||
git commit -m "my fix" file/name.py CHANGELOG.md ...
|
||||
|
||||
# push your new working branch to your fork
|
||||
# - -u tracks it, in case you have to make more fixes
|
||||
git push origin <my branch> -u
|
||||
|
||||
# use the website to create a PR and wait for feedback etc.
|
||||
<PR on website>
|
||||
<PR merged>
|
||||
|
||||
## IF REQUIRED make fixes and re-push them, this is why we tracked it above
|
||||
git commit -m "oopsie daisy" file/name.py
|
||||
|
||||
## IF REQUIRED squash your mistake cause it's just a typo nobody cares
|
||||
|
||||
# get list of commits and find the one BEFORE your above commit
|
||||
git log
|
||||
# rebase your work on that commit ID from the log
|
||||
git rebase -i <HASH ID>
|
||||
# change 'pick' on first line to 'reword'
|
||||
# change every following line to 'fixup'
|
||||
# save-quit, update new commit message
|
||||
# force-push your squashed changed hashes overtop your PR
|
||||
# - this automagically updates on the webUI in realtime
|
||||
git push origin <my branch> -f
|
||||
|
||||
<PR merged>
|
||||
|
||||
## sync your fork and delete your now useless branch from your fork
|
||||
## - it's two steps - first done to working copy, then pushed to your fork
|
||||
|
||||
# switch to the working branch the project uses that you branched off of
|
||||
git checkout devel
|
||||
|
||||
# get the latest upstream code (stashes it locally)
|
||||
git fetch upstream
|
||||
# apply the stashed updates to your working copy
|
||||
git merge upstream/devel
|
||||
# push your working copy to your fork, it's now in sync again
|
||||
git push origin devel
|
||||
|
||||
## IF REQUIRED - delete your branch from working copy, push delete to your fork
|
||||
## - notice the colon in front of the name of the branch in step 2
|
||||
git branch -d <my branch>
|
||||
git push origin :<my branch>
|
||||
|
||||
## if upstream adds a brand new branch after you forked and you want to
|
||||
## integrate it into your workflow
|
||||
git fetch upstream
|
||||
git checkout -b <new branch name> upstream/<new branch name>
|
||||
git push origin <new branch name> -u
|
||||
```
|
||||
|
||||
8
KRB5-Empty-Keytab.md
Normal file
8
KRB5-Empty-Keytab.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Create an empty, but valid, KRB5 keytab file
|
||||
|
||||
```
|
||||
echo -e "\0005\0002\c" >/etc/krb5.keytab
|
||||
chmod 0600 /etc/krb5.keytab
|
||||
chown root:root /etc/krb5.keytab
|
||||
```
|
||||
|
||||
11
Kernel-Decompress.md
Normal file
11
Kernel-Decompress.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Decompress a `vmlinuz` manually by finding the magic offset
|
||||
|
||||
```
|
||||
# od -t x1 -A d vmlinuz | grep "1f 8b 08 00"
|
||||
0018352 1c ff ff ff 1f 8b 08 00 00 00 00 00 02 03 ec dd
|
||||
|
||||
0018352 + 4 = 0018356
|
||||
|
||||
# dd if=vmlinuz bs=1 skip=18356 | zcat > vmlinux
|
||||
```
|
||||
|
||||
54
Linux-Valid-Usernames.md
Normal file
54
Linux-Valid-Usernames.md
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
**POSIX Standard**
|
||||
|
||||
- https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_426
|
||||
- https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_276
|
||||
|
||||
**Upstream Source**
|
||||
|
||||
- https://github.com/shadow-maint/shadow/blob/master/libmisc/chkname.c
|
||||
|
||||
**Debian Family**
|
||||
|
||||
- https://salsa.debian.org/debian/shadow/blob/master/debian/patches/506_relaxed_usernames
|
||||
|
||||
```
|
||||
/*
|
||||
* POSIX indicate that usernames are composed of characters from the
|
||||
* portable filename character set [A-Za-z0-9._-], and that the hyphen
|
||||
* should not be used as the first character of a portable user name.
|
||||
*
|
||||
* Allow more relaxed user/group names in Debian -- ^[^-~+:,\s][^:,\s]*$
|
||||
*/
|
||||
```
|
||||
|
||||
**RHEL Family**
|
||||
|
||||
- https://src.fedoraproject.org/cgit/rpms/shadow-utils.git/tree/shadow-4.5-goodname.patch
|
||||
|
||||
```
|
||||
/*
|
||||
* User/group names must match gnu e-regex:
|
||||
* [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?
|
||||
*
|
||||
* as a non-POSIX, extension, allow "$" as the last char for
|
||||
* sake of Samba 3.x "add machine script"
|
||||
*
|
||||
* Also do not allow fully numeric names or just "." or "..".
|
||||
*/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**BSD Family**
|
||||
|
||||
***OpenBSD***
|
||||
|
||||
- https://cvsweb.openbsd.org/src/usr.sbin/user/user.c?rev=1.123&content-type=text/x-cvsweb-markup
|
||||
|
||||
***FreeBSD***
|
||||
|
||||
- https://github.com/freebsd/freebsd/blob/master/usr.sbin/pw/pw_user.c
|
||||
|
||||
***NetBSD***
|
||||
|
||||
- http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/user/user.c?rev=1.132&content-type=text/x-cvsweb-markup&only_with_tag=MAIN
|
||||
5
MySQL-Connections.md
Normal file
5
MySQL-Connections.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
The "gdb trick" to reach into a running MySQL process and increase the max connections - typically used if root@localhost can't log in on the reserved connection slot.
|
||||
|
||||
```
|
||||
gdb -p $(cat /var/run/mysqld/mysqld.pid) -ex "set max_connections=5000" -batch
|
||||
```
|
||||
46
NFS-10G-Tuning.md
Normal file
46
NFS-10G-Tuning.md
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
Tuning NFS on a 10gbit link - ideas only, test every change
|
||||
|
||||
```
|
||||
# Allow testing with buffers up to 64MB
|
||||
net.core.rmem_max=67108864
|
||||
net.core.wmem_max=67108864
|
||||
|
||||
# Increase Linux autotuning TCP buffer limit to 32MB
|
||||
net.ipv4.tcp_rmem=4096 87380 33554432
|
||||
net.ipv4.tcp_wmem=4096 65536 33554432
|
||||
|
||||
# Raise memory for the fragmentation reassembly buffer
|
||||
# (above high_thresh, kernel starts discarding packets
|
||||
# until usage goes below low_thresh)
|
||||
net.ipv4.ipfrag_high_thresh=524288
|
||||
net.ipv4.ipfrag_low_thresh=393216
|
||||
|
||||
# Turn on TCP timestamps - better calculation method
|
||||
net.ipv4.tcp_timestamps=1
|
||||
|
||||
# Disable saving of TCP metrics on connection close
|
||||
# (test this first - can also degrade performance)
|
||||
# net.ipv4.tcp_no_metrics_save=1
|
||||
|
||||
# Enable select acknowledgments
|
||||
net.ipv4.tcp_sack=1
|
||||
|
||||
# Ensure window scaling is on
|
||||
net.ipv4.tcp_window_scaling=1
|
||||
|
||||
# Raise the max backlog of packets on a net device
|
||||
net.core.netdev_max_backlog=5000
|
||||
|
||||
# Recommended default congestion control is htcp for 10Gbe
|
||||
net.ipv4.tcp_congestion_control=htcp
|
||||
|
||||
# Recommended for hosts with jumbo frames enabled
|
||||
net.ipv4.tcp_mtu_probing=1
|
||||
|
||||
# Maximize the number of task request slots in the RPC code
|
||||
sunrpc.tcp_slot_table_entries=128
|
||||
sunrpc.udp_slot_table_entries=128
|
||||
|
||||
## Also add to /etc/rc.local (10G NIC):
|
||||
## /sbin/ip link set eth4 txqueuelen 10000
|
||||
```
|
||||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
- [[APT WhatProvides]]
|
||||
- [[Apache wpadmin]]
|
||||
- [[Bash Dump History]]
|
||||
- [[Bash Trim Whitespace]]
|
||||
- [[CSS Reset]]
|
||||
- [[DB2 Info]]
|
||||
- [[Debian Upgrade]]
|
||||
- [[Dell OpenManage]]
|
||||
|
|
@ -10,17 +12,23 @@
|
|||
- [[Firefox Tweaks]]
|
||||
- [[Git Combine Repos]]
|
||||
- [[Git Multi SSH]]
|
||||
- [[Git Quickstart]]
|
||||
- [[Git Rewrite User]]
|
||||
- [[Git Server]]
|
||||
- [[Glibc IPv4]]
|
||||
- [[GnuPG Things]]
|
||||
- [[IPv4 Default Gateway]]
|
||||
- [[KRB5 Empty Keytab]]
|
||||
- [[Kernel Boot Debug]]
|
||||
- [[Kernel Decompress]]
|
||||
- [[LUKS Encrypted Partitions]]
|
||||
- [[Linux Valid Usernames]]
|
||||
- [[Loopback FS]]
|
||||
- [[MX Blackhole]]
|
||||
- [[Mount OVA]]
|
||||
- [[Mount qcow2]]
|
||||
- [[MySQL Connections]]
|
||||
- [[NFS 10G Tuning]]
|
||||
- [[Netcat Replacements]]
|
||||
- [[Proxmox Doodads]]
|
||||
- [[RPM Info]]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue