:set list
,\l
- show invisibles:retab!
- auto converting between tabs and spaces:set expandtab
,retab!
- to spaces:set noexpandtab
,retab!
- to tabs
.
- repeat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cause | |
tuned expects python2 as its intepreter. the script does not specify the python version and it installs all of the modules are installed in /usr/lib/python2.7/. If you have python3 installed, the service will fail to start because python3 does not have the *tuned* module dependencies. The sanest solution that should survive upgrades and changes to tuned python, is to give the systemd service the correct python environment in which to execute via override. Until, of course, tuned gets ported to python3. | |
tested with tuned 2.9.0-1 in ubuntu 18.04 | |
1. sudo apt-get install tuned | |
2. sudo systemctl edit tuned | |
[Service] | |
Environment=PYTHONHOME=/usr/lib/python2 | |
Environment=PYTHONEXECUTABLE=/usr/bin/python2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from io import BytesIO | |
from tqdm import tqdm | |
file = 'FILENAME' | |
fsize = int(os.path.getsize(file)) | |
new = 'NEWFILENAME' | |
with open(file, 'rb') as f: | |
with open(new, 'ab') as n: | |
with tqdm(ncols=60, total=fsize, bar_format='{l_bar}{bar} | Remaining: {remaining}') as pbar: | |
buffer = bytearray() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function vid2gif () { | |
vid="$1" | |
#start_time=00:00:01 | |
#duration=5 | |
height=-1 # input height halved , can replace with pixils . | |
width=480 # keeps aspect ratio . can replace with pixils . | |
fps=25 # frames per a second . | |
filters="fps=$fps,scale=$width:$height:flags=lanczos" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lint a service unit file. | |
sudo systemd-analyze verify foobar.service |
Command | Editing Shortcuts |
---|---|
ctrl+a, ctrl+e | Go to the start/end of the command line |
ctrl+u, ctrl+k | Delete from cursor to the start/end of the command line |
ctrl+w, alt+d | Delete from cursor to start/end of word (whole word if at the boundary) |
ctrl+y | Paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor |
ctrl+xx | Move between start of command line and current cursor position (and back again) |
alt+b, alt+f | Move backward/forward one word (or go to start of word the cursor is currently on) |
alt+C | Capitalize to end of word starting at cursor (whole word if cursor is at the beginning of word) |
alt+u | Make uppercase from cursor to end of word |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch -n1 -d "iptables -vnxL | grep -v -e pkts -e Chain | sort -nk1 | tac | column -t |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert cert downloaded from digicert to base64 | |
openssl x509 -inform DER -in DigiCertSHA2SecureServerCA.crt -out DigiCertSHA2SecureServerCA.cer | |
Verify CA against SSL | |
openssl verify -verbose -CAfile DigiCertSHA2SecureServerCA.cer server.pem | |
Check that key matches cert, md5 output should be excatly the same if good. | |
openssl x509 -noout -modulus -in certificate.crt | openssl md5 | |
openssl rsa -noout -modulus -in privateKey.key | openssl md5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list available instance reservations | |
for k,v in d.items(): | |
for r in v['ReservedInstances']: | |
if int(str(datetime.datetime.strptime(r['End'], '%Y-%m-%dT%H:%M:%S.000Z') - datetime.datetime.now()).split(',')[0].split(' ')[0]) > 0: | |
print(k, r['End'], r['InstanceCount'], r['InstanceType']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
in MacOs, hydrogen looks at /Users/<USER>/Library/Jupyter/kernels/python3/kernel.json for its kernel but when you are using pyenv and you install a kernel with ipykernel, it the kernel.json file is stored in /usr/local/share/jupyter/kernels/python3/kernel.json | |
The solution is to copy or symlink the installed kernel.json to where hydrogen expects the file to be: | |
ln -sf /usr/local/share/jupyter/kernels/python3/kernel.json /Users/<USER>/Library/Jupyter/kernels/python3/kernel.json | |
You'll have to re-start atom. |