Skip to content

vimm0/auto-script

Repository files navigation

Auto-script

Always be curious, always read the source material, and always try it yourself.

"learn the basics/roots first" principle applies to pretty much everything in life. From learning a new programming language to starting a new sport. It requires a lot of practice, but once you master it, the only thing left to do is to get creative with it. And that's where the real fun begins.

Initiative for creating easy auto scripts Snippets are reusable with little or no changes . If you are new to programming or simply interested in learning different scripts, here are some resources you can use.

😊 Feel free to contribute, fork, star

Table of Content

# debugging to specific point in code in python code
# add specific code
import pdb
pdb.set_trace
# and run
py.test
or
py.test --capture=no
# Enable two monitor in i3
xrandr --output HDMI1 --auto --right-of eDP1 

pip is not recognized in windows

  • echo %PATH%
  • setx PATH "%PATH%;C:/path-upto-scripts"

Design Patterns

Test driven approach

The best way to do code testing is by using Test-Driven Development (TDD).

This is how it works:

Write a test. – The test will flesh out some functionality in your app.

run the test – The test should fail, since there's no code to make it pass.

Write the code – To make the test pass

Run the test – If it passes, you are confident that the code you've written meets the test requirements

Refactor code – Remove duplication, prune large objects and make the code more readable. Re-run the tests every time you refactor the code

Repeat – That's it!

Android development Roadmap 2019

Electon app with python

Wipe out all the data from pendrive sudo dd if=/dev/zero of=/dev/sdb1 bs=1k count=2048

VanillaJS is the same as pure Javascript.

Vanilla in slang means:

unexciting, normal, conventional, boring

Vim configuration
  • create ~/.vimrc
    • set mouse=a # helps in mouse action
Vim useful shortcuts
  • copy from vim to outside vim

    • make sure set mouse=a is enabled in .vimrc
    • while copying make sure to press shift and then ctrl+shift+c to copy
  • Split screen

    • Open file
      • :Sex /path/to/file
      • :Vex /path/to/file
    • navigate between screen
      • ctrl+w+v
      • ctrl+w+l
      • ctrl+w+h
      • ctrl+w+s
      • ctrl+w+j
      • ctrl+w+k
    • Change screen size
      • ctrl+w+">"
      • ctrl+w+"<"
      • ctrl+w+"+"
      • ctrl+w+"="
  • Copy/Paste

    • enter to visual mode with ctrl+v
    • select the block up to which you want to copy and move cursor with h,j,k,l
    • cut (with d) or copy (with y)
    • paste with either p or P
  • Editing

    • undo/redo
      • u: undo last change
      • ctrl+r
  • reference

Video

Network Penetration Testing for Beginner https://www.youtube.com/watch?v=L6SlXzk3Efo

find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf

Types of Application development
  • Standalone business application: This is your typical application, and is like applications like Word, Excel, Outlook and more. Anything that can be used by someone to make their work more efficient would fall into this category.
  • Client-Server Application: This is an application that runs on the computer but accesses information from a remote server.
  • Collaborative Application: This is an application that is designed to help people involved in a common task. This is a way for people to work together at once, using the same application on each of their computers.
  • Utilities and Plug-Ins: Anything that can help a computer or browser run more efficiently would fall into this category.
  • System Apps and Services: Anything that allows the computer to run various other applications would fall into this category.
  • Multimedia Applications: This is an application that plays podcasts, movies, video, music and more. iTunes is a good example of this.
  • Network Applications: Anything that runs over a network falls into this category.
ssh with two linux computer
  • connect with lan cable between two computer
  • install, enable, start ssh service
  • also compulsary to add password in linux machine
  • ping ssh with ping ipaddress
  • ssh remote linux with ssh ipaddress
  • scp -r /file path/to/copy user@ipaddress:/path/to/paste
  • ls -lh //list path with human readable file size
Google's Webp Conversion (2019-05-21)

Git

Use aliases. Though there aren't any native Git one-liners, you can define your own as

git config --global alias.clone-branches '! git branch -a | sed -n "/\/HEAD /d; /\/master$/d; /remotes/p;" | xargs -L1 git checkout -t'

and then use it as

git clone-branches

Arch linux

Aws

OAuth Google

Authorized JavaScript origins = http://localhost:8000
Authorized redirect URIs = http://localhost:8000/complete/google-oauth2/

Serve frontend locally

   npm install -g serve
   serve -s dist

OhoDomain in netlify

  • manage nameserver default is,
ns1: ohodomain.earth.orderbox-dns.com
ns2: ohodomain.mars.orderbox-dns.com
ns3: ohodomain.mercury.orderbox-dns.com
ns4: ohodomain.venus.orderbox-dns.com

with
dns1.p04.nsone.net
dns2.p04.nsone.net
dns3.p04.nsone.net
dns4.p04.nsone.net
  • manage dns with type A record ip: 104.198.14.52
  • domain forward with destination nepex.netlify.com

Commandline

Add frontend dist to gh-pages(automated)

npm install push-dir --save-dev
In package.json, "deploy": "push-dir --dir=dist --branch=gh-pages --cleanup",
npm run generate
npm run deploy

Error (Archlinux)

  • while update, unable to lock database
    • sudo rm /var/lib/pacman/db.lck

Responsive Breakpoints

For optimal user experience, material design user interfaces should adapt layouts for the following breakpoint widths: 480, 600, 840, 960, 1280, 1440, and 1600dp.

Docker

Python

Server

Handy Commands

Handy Commnads

Dependency installer for ruby:

For installing bundler system-wide. To do this, you need to pass --no-user-install flag to gem and execute it with sudo: sudo gem install bundler --no-user-install Stack Overflow

Jekyll

  • bundle install
  • bundle exec jekyll serve

ngrok http host-header

ngrok http 8080 -host-header="localhost:8080"

Package Manager

  • yarn upgrade-interactive --latest
  • yarn upgrade --latest

Devnagiri fonts in archlinux

sudo yaourt -S ttf-indic-otf

Daemonize

  • redis-server --daemonize yes
  • ps aux | grep redis-server

Dockerize

  • sudo usermod -a -G docker $USER

Frontend locally run

  • npm install -g serve
  • serve -s dist

You don't have /home//.gem/ruby/2.6.0/bin in your PATH

gem executables will not run.

  • You need to have Ruby and Compass installed and in your system PATH for this task to work.
    • export PATH="/home/ryan1/.gem/ruby/1.9.1/bin:$PATH"

VSCODE

When commenting a line, move the cursor to the next line Use geddski.macros extension:

  • Add macro to settings.json -- "macros": { "commentLine": ["editor.action.commentLine","cursorDown"] }

  • Map a key in keybindings.json (use you own favorite key combo) -- { "key": "ctrl+/", "command": "macros.commentLine", "when": "editorTextFocus && !editorReadonly" }

Reference