Skip to content

prashant523580/auto-script

 
 

Repository files navigation

Auto-script

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

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

Archlinux

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

Django tenant

  • Migrate ./manage.py migrate_schemas --shared # migrate database to public schema
  • Open Shell ./manage.py shell
from apps.customer.models import Client 
   ...: # create your public tenant 
   ...: tenant = Client(domain_url='my-domain.com', # don't add your port or www here! on a local server you'll want to use localhost here 
   ...:                 schema_name='website', # change to app name or suitable schema name otherwise tenant doesnot migrate
   ...:                 name='Schemas Inc.', # organization name
   ...:                 paid_until='2016-12-05', 
   ...:                 on_trial=False) # for later use: billing purpose
   ...: tenant.save()      
   create client now
  • create superuser./manage.py createsuperuser --schema=website

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

Genymotion Installation

In Archlinux, copy url of snapshot from AUR

  • https://aur.archlinux.org/cgit/aur.git/snapshot/genymotion.tar.gz
  • wget https://aur.archlinux.org/cgit/aur.git/snapshot/genymotion.tar.gz
  • $ cd genymotion.tar.gz
  • $ makepkg -sri

Make sure to install

  • virtualbox-host-dkms
  • $ sudo pacman -S linux-headers
  • $ sudo vboxreload

Android Installation

  • bash <(curl -s archibold.io/install/android)

  • Put in .bashrc or .zshrc

  • export ANDROID_HOME="/opt/android-sdk"

  • export JAVA_HOME="/usr/lib/jvm/java-8-openjdk/"

  • sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "build-tools;25.0.3" "extras;android;m2repository" "extras;google;m2repository"

  • npm install -g nativescript --unsafe-perm

  • more

Android Studio

  • yaourt -S android-studio
  • yaourt -S android-tools android-udev
  • sudo gpasswd -a awecode adbusers
  • yaourt -S genymotion
  • uname -r
  • yaourt linux-headers
  • restart
  • open android studio

To increase size of tmp/ (in case No space left on device warning came up)

  • mount -o remount,size=5G /tmp/

Weex build

  • git clone https://github.com/tralves/weex-todo-list 204
  • yarn (or npm install)
  • yarn build (or npm run build)
  • yarn copy:android (or npm run copy:android)
  • open android folder in Android Studio
  • Either run app or build apk!

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

Nested Grid Vuetify

 <v-container grid-list-md text-xs-center>
    <v-layout row wrap>
      <v-layout>
        <v-flex xs6>
          <v-layout row>
            <v-layout justify-center>
              <v-flex xs6>
                <v-card dark color="secondary">
                  <v-card-text class="px-0">6</v-card-text>
                </v-card>
              </v-flex>
            </v-layout>
            <v-layout justify-end>
              <v-flex xs6>
                <v-card dark color="secondary">
                  <v-card-text class="px-0">6</v-card-text>
                </v-card>
              </v-flex>
            </v-layout>
          </v-layout>
        </v-flex>
        <v-layout justify-center>
          <v-flex xs6>
            <v-card dark color="secondary">
              <v-card-text class="px-0">6</v-card-text>
            </v-card>
          </v-flex>
        </v-layout>
      </v-layout>
    </v-layout>
  </v-container>

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

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

Releases

No releases published

Packages

No packages published

Languages

  • Java 73.0%
  • JavaScript 14.3%
  • Shell 4.6%
  • HTML 4.2%
  • Python 3.9%