Vim Useful Commands List - 1

Vim Useful Commands List - 1 Command Description i insert - insert new text before cursor x delete current character X backspace delete previous character i insert - insert new text before cursor x delete current character X backspace delete previous character u undo Escape change to command mode o new line below O new line above dd cut current line dw cut current word p paste before P paste after /[search_string] find [search_string] n next result N previous result /( find next opening parentesis % jump to matching parentesis ci( change all text inside brackets () di( delete all text inside brackets () w next word Ctrl-D move down a page (around 15 lines) Ctrl-U move up a page (around 15 lines) :new [filename] open a new [filename] to edit (can {tab} to see list) Ctrl-w w switch down between windows / buffers Ctrl-w W switch up between windows / buffers Ctrl-w N Convert terminal into a “normal mode” buffer :ls list opened buffers / files opened for edit :wa write all - save all opened files :bd buffer delete - to close current buffer :term opens terminal in separate window yw yank / copy word yy yank / copy line

April 12, 2024 · 1 min

Python Script to Get Local IPs

Python 3 Script to Get IPs #!/usr/bin/env python3 def getips(): import re import subprocess # get ip(s) from ifconfig found_ips = [] ips = re.findall( r'[0-9]+(?:\.[0-9]+){3}', subprocess.getoutput("/sbin/ifconfig")) for ip in ips: if ip.startswith("255") or ip.startswith("127") or ip.endswith("255"): continue found_ips.append(ip) return ", ".join(found_ips)

January 1, 2020 · 1 min

Python 3 Script to Send Mail via Gmail

Python 3 Script to Send eMail via GMail def emailsend(subject_part, message_part): # usage: emailsend("Server is up", "") import time import smtplib import socket from datetime import datetime current_utc = datetime.utcnow().isoformat() + 'Z' ####--[CONFIGURATION] server = 'smtp.gmail.com' server_port = '587' username = 'INSERT-YOUR-USERNAME@gmail.com' password = 'INSERT-YOUR-PASSWORD' hostname = socket.gethostname() from_addr = 'INSERT-YOUR-FROM-NAME <INSERT-YOUR-FROM@gmail.com>' to_addr = 'INSERT-YOUR-TO-EMAIL' subject = 'INSERT-YOUR-SUBJECT-PREPEND | ' + hostname + ' | ' + subject_part message = 'INSERT-YOUR-MESSAGE-PREPEND | ' + hostname + ' | <br>' + message_part + '<br><br><br>Email Generated On (UTC): ' + current_utc ####--[/CONFIGURATION] headers = [ "Subject: " + subject, "From: " + from_addr, "To: " + to_addr, "MIME-Version: 1.0", "Content-Type: text/html" ] headers = "\r\n".join(headers) server = smtplib.SMTP(server + ":" + server_port) server.ehlo() server.starttls() server.ehlo() server.login(username,password) server.sendmail(from_addr, to_addr, headers + "\r\n\r\n" + message) server.quit()

November 16, 2019 · 1 min

Check Speed of Dns Servers wtih Dig

Check the speed of OpenDNS and Google Public DNS servers OpenDNS Server addresses: 208.67.222.222 208.67.220.220 Google Public DNS Server addresses: 8.8.8.8 8.8.4.4 Test Server: brooklyn-chess.com echo OpenDNS ... ; dig @208.67.222.222 brooklyn-chess.com | grep Query; dig @208.67.220.220 brooklyn-chess.com | grep Query; echo Google DNS ... ; dig @8.8.8.8 brooklyn-chess.com | grep Query; dig @8.8.4.4 brooklyn-chess.com | grep Query;

November 16, 2019 · 1 min

Remove Win10 Icon and Fix Auto Updates

Remove Windows 10 Icon and Fix Auto Updates Run cmd as Administrator C:\>powershell Windows PowerShell Copyright (C) 2009 Microsoft Corporation. All rights reserved. PS C:\> get-hotfix -id KB3035583, KB2952664, KB2976978, KB3021917, KB3044374, KB2990214 Source Description HotFixID InstalledBy InstalledOn ------ ----------- -------- ----------- ----------- MYPCNAME Update KB2952664 NT AUTHORITY\SYSTEM 7/15/2015 12:00:00 AM MYPCNAME Update KB2990214 NT AUTHORITY\SYSTEM 4/15/2015 12:00:00 AM MYPCNAME Update KB3021917 NT AUTHORITY\SYSTEM 2/11/2015 12:00:00 AM MYPCNAME Update KB3035583 NT AUTHORITY\SYSTEM 7/17/2015 12:00:00 AM PS C:\> exit C:\>wusa /uninstall /kb:2952664 C:\>wusa /uninstall /kb:2990214 C:\>wusa /uninstall /kb:3021917 C:\>wusa /uninstall /kb:3035583 C:\>

July 24, 2015 · 1 min