Skip to content

Instantly share code, notes, and snippets.

View Hansimov's full-sized avatar

Hansimov

View GitHub Profile
wget --user=<username> --ask-password <url> --no-check-certificate
@Hansimov
Hansimov / copy_folder.py
Created July 20, 2021 02:29
python copy folder recursively
cmd_cp_folder = 'cp -a {} {}'
def copy_folder(src, dst):
src = os.path.join(src, '.')
shell_cmd(cmd_cp_folder.format(src,dst))
copy_folder('dir1', 'par/dir2')
@Hansimov
Hansimov / elapsed_time.py
Created July 20, 2021 02:32
Python get program start, end and elapsed time
import datetime
def time2str(t): # time to string
if isinstance(t, datetime.datetime):
return t.strftime('%Y-%m-%d %H:%M:%S')
elif isinstance(t, datetime.timedelta):
return '{} hr {:02} min {:02} s'.format(t.seconds//3600, (t.seconds//60)%60, t.seconds%60)
else:
return str(t)
@Hansimov
Hansimov / linux_term_color.py
Last active June 4, 2022 00:54
Linux terminal print colorful text
def print_format_table():
"""
prints table of formatted text format options
"""
for style in range(8):
for fg in range(30,38):
s1 = ''
for bg in range(40,48):
format = ';'.join([str(style), str(fg), str(bg)])
s1 += '\x1b[%sm %s \x1b[0m' % (format, format)
@Hansimov
Hansimov / windows_git_bash_netrc.md
Created June 6, 2022 16:56
Windows Git bash use token in _netrc
  1. Go to GitHub > Settings > Developer Settings > Personal access tokens > Generate new token, and copy it

  2. Create _netrc under C:\Users\<username>, write the following content into it:

    machine github.com
    login <username>
    password ghp_*****************************
    
  3. Then git bash will use this token to communicate with remote server

@Hansimov
Hansimov / vscode_plugins_xhr_failed.md
Last active June 20, 2022 07:22
VSCode: Failed to fetch plugins XHR failed

Ctrl+Shift+P > Settings > Http: Proxy> Set http://proxy-prc.intel.com:913