semvec/pypi-packages huggingface dataset:
urlshrink 0.61
url smallifier
Keywords: smoll url bean

# urlshrink
an open source python based url shortener
- [X] sqlite database
- [X] hashids 
- [X] redirection
- [X] hit counting
- [X] copy buttons
- [X] delete button
- [X] qr codes
- [X] options
  - [X] key / password or public deletable
  - [X] gets destroyed after x timeunits
- [X] db cleansing after X days so the hashids don't get too long 
- [X] sqlmap --risk 3 --level 5 nothing found
- [X] cookie info
- [X] made by
  
- [X] hashed fields
    - username
    - password
- [X] encrypted fields
    - using Argon2
    - url (if password for it is specified)
  
- [ ] users
  - [X] registration
    - [X] generated username
      
  - [X] add shortened url to currently logged-in user instance
  - [ ] share urls between users
    - [ ] access groups
      
  - [ ] free version:
    - [ ] delete user after x months without login
    - [ ] delete url after x years or x months without usage
    - [ ] user can only hold N shortened urls
  - [ ] paid version:
    - [ ] encryption_level + N
    - [ ] user and the users urls do not get deleted
    - [ ] user can hold {CALCULATE_ME} shortened urls
    
- [ ] sharing via platforms
- [ ] statistics
- [ ] also accept torrent, ftp, ssh, etc. urls
    - [ ] detect protocol and show label
        - some protocols can be dangerous
        - add notification for dangerous urls
  
### stuff that was originally planned but won't be done
- [ ] cli client (useless)
- [ ] api for android app (useless)
near-corr-mat 0.0.1
Find the nearest correlation matrix to a given one
Requires Python: >=3.9

This package provides fast computations of the nearest correlation matrix, in the Euclidian setting.

# Problem and its dual

A correlation matrix is a real symmetric positive semidefinite matrix with unit diagonal.
The problem is to find the closest correlation matrix to a given positive semidefinite matrix, for the Frobenius norm. Five algorithms are implemented, to the best of my knowleddge, the second one is an original application of the ADMM to this problem. Although the algorithms were not published recently, I am not aware of any freely accessible implementation, apart from the Python module Statsmodels providing the first algorithm.

# Five algorithms implemented

Five algorithms are implemented in the main function *nearest_corr*. The first two are based on the primal problem, while the last three are (directly) based on the dual problem.

1. The algorithm 'grad' is based on [Higham, 2002](https://www.maths.manchester.ac.uk/~higham/narep/narep369.pdf).
This algorithm is a modified Dykstra's projection algorithm.
2. The algorithms 'admm_v0' and 'admm_v1' are ADMMs. Two versions are implemented, depending on the order in which the projections are performed. The two algorithms are different but have similar performances.
3. The algorithm 'bfgs' is the BFGS algorithm applied to the dual problem, as developped in [Malick, 2004](https://hal.inria.fr/inria-00072409v2/document). The implementations are based on [BGLS textbook](https://link.springer.com/book/10.1007/978-3-540-35447-5).
4. The algorithm 'l_bfgs' is the limited BFGS algorithm applied to the dual problem, as suggested in Malick. The implementations are based on the same book.
5. The algorithm 'newton' is a Newton's method for the dual problem, developped in [Qi, Sun, 2006](http://www.personal.soton.ac.uk/hdqi/REPORTS/simax_06.pdf).

# Performances

These algorihms were tested on random 100 x 100 matrices, for err_max = 1e-6 (*cf.* performances.ipynb), which should be enough for a large range of use cases. The ranking of the algorithms' speeds may be significantly different for other ranges of parameters, *cf.* table in Qi, Sun. On a given machine, the algorithms have the following performances.

| algo     | time  | n_iterations |
|----------|-------|--------------|
| grad     | 20 s  | 1500         |
| admm_v0  | 8 s   | 500          |
| admm_v1  | 8 s   | 500          |
| bfgs     | 1 s   | 100          |
| l-bfgs   | 2 s   | 100          |
| newton   | 60 s  | 100          |