Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
If you have Mac system and created bash scripts so far, there is a fun feature on OS X that you can type say command. say will say the phrase:
say hello channel users

Or let's say you have a bash script that will take a lot of time and at the end of the script your want to hear operation done successfully from your speaker:
say operation done successfully

#osx #say #command #fun
There is a command in osX called open that will open finder for you from within of your terminal.

The great thing about this command is that you can open finder when you have traversed a long path and now you want it to have inside of finder. Go to the desired directory in your terminal using cd then use:
open .

it will open you finder. :)

#osx #open #command #fun #trick
How do I remove the passphrase for the SSH key without having to create a new key?

I set a passphrase when creating a new SSH key on my laptop. But, as I realise now, this is quite painful when you are trying to commit (Git and SVN) to a remote location over SSH many times in an hour.
$ ssh-keygen -p
Enter file in which the key is (/Users/my_username/.ssh/id_rsa):
Enter old passphrase:
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.

This will then prompt you to enter the keyfile location, the old passphrase, and the new passphrase (`which can be left blank to have no passphrase`).

If you would like to do it all on one line without prompts do:
$ ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]

NOTE: Beware that when executing commands they will typically be logged in your ~/.bash_history file (or similar) in plain text including all arguments provided (i.e. the passphrases in this case). It is therefore is recommended that you use the first option unless you have a specific reason to do otherwise.

You might want to consider using ssh-agent, which can cache the passphrase for a time. The latest versions of gpg-agent also support the protocol that is used by ssh-agent.

#id_rsa #ssh #passphrase #keygen #linux #osx #remove_passphrase
https://electron.atom.io/

Build cross platform desktop apps with JavaScript, HTML, and CSS

#multi_platform #cross_platform #css #js #electron #osx #windows #linux #desktop #application
In case you want to add a custom font to OS X, you need to go to /Library/fonts and paste your custom fonts in this folder. No need to restart or logout.

reference: https://support.apple.com/en-us/HT201722

#apple #osx #font #fonts
In os x you can use repeat command to repeat a command! If you want to send multiple get request using cURL:
repeat 10 curl https://www.google.com

In Linux we can do the same using for loop:
for i in {1..12}; do echo 'test'; done

#osx #linux #repeat #for
diff command is usually used to get differences between two files:
diff file1.py file2.py

Interesting part of this is that we can even get the differences between to folders, which differ in some files:
diff -bur folder1 folder2

b flag means ignoring whitespace.
u flag means a unified context (3 lines before and after).
r flag means recursive.

#linux #osx #diff
To get time in epoch in linux`/`OS X you can use date with formatting like below:

date +%s


The output of the command is similar to the following output:

1518517636


#linux #osx #date #epoch
One of the issues you always face with postgres on new systems is pg_config error. If you don't want to install postgres and willing to have postgres library in Pytho operational:

1. brew install libpq
2. xcode-select --install
3. echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.zshrc
4. env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip3 install psycopg2

#osx #libpq #pg_config #postgres #postgresql #xcode