This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ----------------------------------------------------------------------------- | |
| # AI-powered Git Commit Function | |
| # Copy paste this gist into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It: | |
| # 1) gets the current staged changed diff | |
| # 2) sends them to an LLM to write the git commit message | |
| # 3) allows you to easily accept, edit, regenerate, cancel | |
| # But - just read and edit the code however you like | |
| # the `llm` CLI util is awesome, can get it here: https://llm.datasette.io/en/stable/ | |
| gcm() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding=utf-8 | |
| # Copyright 2023 The HuggingFace Inc. team. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -------------------------------------------------------------------- | |
| # Recursively find pdfs from the directory given as the first argument, | |
| # otherwise search the current directory. | |
| # Use exiftool and qpdf (both must be installed and locatable on $PATH) | |
| # to strip all top-level metadata from PDFs. | |
| # | |
| # Note - This only removes file-level metadata, not any metadata | |
| # in embedded images, etc. | |
| # | |
| # Code is provided as-is, I take no responsibility for its use, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def measure_semantic_shift_by_neighborhood(model1,model2,word,k=25,verbose=False): | |
| """ | |
| Basic implementation of William Hamilton (@williamleif) et al's measure of semantic change | |
| proposed in their paper "Cultural Shift or Linguistic Drift?" (https://arxiv.org/abs/1606.02821), | |
| which they call the "local neighborhood measure." They find this measure better suited to understand | |
| the semantic change of nouns owing to "cultural shift," or changes in meaning "local" to that word, | |
| rather than global changes in language ("linguistic drift") use that are better suited to a | |
| Procrustes-alignment method (also described in the same paper.) | |
| Arguments are: |
Taken from: [https://groups.google.com/forum/#!topic/devpi-dev/S-3ioWILTiY]).
We wanted to do some python developpement but we had a problem : our working network is completely isolated from any internet access, only having servers providing services like distribution packages repository mirror and web servers. The question then was how to make a full pypi mirror for usig pip install and pip search.
This is possible to be done using devpi, a web server, bandersnatch and an external hard drive. The idea is to dump all pypi packages with bandersnatch, transfer them to the server with the hard drive,
NetworkManager supports WiFi powersaving but the function is rather undocumented.
From the source code: wifi.powersave can have the following value:
- NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0): use the default value
- NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1): don't touch existing setting
- NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2): disable powersave
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def smart_procrustes_align_gensim(base_embed, other_embed, words=None): | |
| """Procrustes align two gensim word2vec models (to allow for comparison between same word across models). | |
| Code ported from HistWords <https://github.com/williamleif/histwords> by William Hamilton <wleif@stanford.edu>. | |
| (With help from William. Thank you!) | |
| First, intersect the vocabularies (see `intersection_align_gensim` documentation). | |
| Then do the alignment on the other_embed model. | |
| Replace the other_embed model's syn0 and syn0norm numpy matrices with the aligned version. | |
| Return other_embed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Options +ExecCGI | |
| AddHandler cgi-script .cgi | |
| RewriteEngine On | |
| RewriteBase / | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteRule ^(.*)$ flask.cgi/$1 [QSA,L] |
NewerOlder