Giter Club home page Giter Club logo

scripts's Introduction

Scripts:

Other useful scripts

Pipeline

find . -name "file.txt"                 # file a file with name file.txt in the current folder
cat $(find . -name "file.txt")          # then display on the screen
find . -name "file.txt" | xargs cat     # or we can use a pipeline with xargs to specify a parameter

Merge & Separate pdf files

pdfunite in_1.pdf in_2.pdf in_3.pdf out.pdf
pdfseparate input.pdf %d.pdf

Run Visual Studio from terminal

# add in ~/.bash_profile

# visual studio
export PATH=$PATH:/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin

source ~/.bash_profile

# now we can call
code folder

Kill process

top                         # get a list of currently running process
ps aux | grep "name"        # a: show processes, u: show users, x: show processes not attached to terminal
ps aux | grep chrome

sudo lsof -i tcp:8080       # show a list of processes running on port 8080

kill pID                    # pID: process ID
killall pName               # kill processes by name
kill -[1|2|9|15|17|19|23]   # 1: hangup, 2: interrupt from keyboard, 9: kill signal, 
                            # 15: terminate signal, 17, 19, 23: stop process
kill -9 2123
killall -9 chrome

How to modify video's properties (resolution, frame rate)

ffmpeg -i input.mov -vf scale=886:1920 output.mov                     # change resolution
ffmpeg -i input.mov -vf scale=886:1920,setsar=1:1 output.mov          # change resolution (better)
ffmpeg -i input.mov -filter:v fps=30 output.mov                       # change frame rate
ffmpeg -i input.jpg -vf scale=320:240 output_320x240.png              # same works for image too

How to record simulator's screen

xcrun simctl io booted recordVideo --code=h264 --mask=black --force output.mov    # no sound --> Apple will reject

# using iMovie to combine audio & video
# choose File -> New App Preview. First import (CMD+I) the screen shot, 
# and then the video you recorded. This way the exported video will be the proper resolution.

How to know size of a folder

du -sh folder
du -sh *                                        # display sizes of all folders & files in the current folder
du -sh * | sort -rh                             # display & sort by decreasing order
du -sh * | sort -rh | head -20                  # display top-20 biggest sub-folders in the current folder

Turn on/off proxy

networksetup -setwebproxy wi-fi localhost 3128
networksetup -setwebproxy wi-fi off             # not working!!!
networksetup -setwebproxy wi-fi on              # not working!!!

networksetup -setsecurewebproxy wi-fi localhost 3128
networksetup -setsecurewebproxy wi-fi off       # not working!!!
networksetup -setsecurewebproxy wi-fi on        # not working!!!

scripts's People

Contributors

chipbk10 avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.