Skip to content

Instantly share code, notes, and snippets.

@SZanlongo
SZanlongo / readme-template.md
Last active August 10, 2019 20:26
README Template

README Template

One-sentence project description.

Table of Contents

@SZanlongo
SZanlongo / fix_indexing.md
Last active July 16, 2019 14:54
Windows 10 not Indexing Applications

From: https://superuser.com/a/955711/65216

Reinstall Cortana using the following procedure:

  1. Open an elevated Command Prompt window (press win + X, and then press A)

  2. Type start powershell and press enter

  3. Run the command (in one line):

@SZanlongo
SZanlongo / remote.md
Created May 16, 2019 19:13
Remote Access to IPython Notebooks via SSH

Remote machine, start the IPython notebooks server:

remote_user@remote_host$ ipython notebook --no-browser --port=8889

Local machine, start an SSH tunnel:

local_user@local_host$ ssh -N -L localhost:8888:localhost:8889 remote_user@remote_host

Open browser on local machine and type in the address bar:

@SZanlongo
SZanlongo / format_disk.md
Created April 13, 2019 15:34
Format Unknown Disk Capacity
  1. Plug-in your USB flash drive to USB port.
  2. Open Command Prompt with admin rights. Use any of the below methods to open Command Prompt.

Type cmd in Start menu

  1. You need to know about the USB drive a little bit. Type in the following commands in the command prompt:

First type DISKPART and hit enter to see the below message. (this opens the disk-partition manager)

>>> Next type LIST DISK command and note down YOUR FLASH DRIVE'S Disk number (eg: Disk 1). BE CAREFUL NOT TO CHOOSE YOUR PRIMARY HARD-DRIVE.

@SZanlongo
SZanlongo / uninstall.md
Last active April 4, 2019 20:35
Uninstall setup.py Installation

You need to remove all files manually, and also undo any other stuff that installation did manually.

If you don't know the list of all files, you can reinstall it with the --record option, and take a look at the list this produces.

To record a list of installed files, you can use:

python setup.py install--record files.txt

Once you want to uninstall you can use xargs to do the removal:

@SZanlongo
SZanlongo / reset_env.md
Created March 13, 2019 00:37
Reset anaconda environment to original state

conda install --revision 1

@SZanlongo
SZanlongo / clip_values
Created March 8, 2019 17:19
Replace negative values in numpy array with zero
import numpy as np
a = np.array([[0, 19], [-1, 8], [-2, -20]])
a = a.clip(0)
print(a)
@SZanlongo
SZanlongo / Remove Shortcut Text.reg
Created January 13, 2019 15:45
Remove - Shortcut text when Creating Windows Shortcuts
Windows Registry Editor Version 5.00
; created by Walter Glenn
; for How-To Geek
; article: http://www.howtogeek.com/281753/how-to-remove-the-shortcut-text-from-new-shortcuts-in-windows/
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer]
"link"=hex:00,00,00,00
@SZanlongo
SZanlongo / file_count.md
Created September 6, 2018 15:39
Count Files in the Current Directory

ls -1 | wc -l

What does it mean for the ranges to overlap? It means there exists some number C which is in both ranges, i.e.

x1 <= C <= x2

and

y1 <= C <= y2

Now, if we are allowed to assume that the ranges are well-formed (so that x1 <= x2 and y1 <= y2) then it is sufficient to test