Skip to content

Instantly share code, notes, and snippets.

View drvenabili's full-sized avatar

Simon Hengchen drvenabili

View GitHub Profile
@drvenabili
drvenabili / networkmanager-wifi-powersave.md
Created November 6, 2023 08:47 — forked from jcberthon/networkmanager-wifi-powersave.md
NetworkManager Wi-Fi powersaving configuration

NetworkManager WiFi Power Saving

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
# à mettre dans /usr/local/bin
#!/usr/bin/env bash
if [ ! -d "env" ]; then
echo "Creating venv..."
python3 -m venv env
echo "Activating venv..."
source env/bin/activate
if test -f "requirements.txt"; then
echo "Installing reqs..."
# à mettre dans /usr/local/bin
watch -n .5 'cat /proc/cpuinfo | grep "MHz" && echo && sensors | grep "Package" && echo && cat /proc/acpi/ibm/fan | head -n 3 | tail -n 2 && echo "" && cat /sys/devices/virtual/powercap/intel-rapl-mmio/intel-rapl-mmio:0/constraint_0_power_limit_uw && echo && cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor && echo && nvidia-smi'
#!/usr/bin/env bash
## This will download and unzip the full bib from the ACL Anthology
## Place this in a publicly accessible folder so you can link the file in Overleaf etc.
## Cronjob to update the file every day at 2 AM:
## 0 2 * * * cd /home/sigmund/aclbib/ && sh dl-bib-extract.sh
wget https://www.aclweb.org/anthology/anthology.bib.gz
gunzip -f anthology.bib.gz
rm -f anthology.bib.gz
cloud-user@dhh17:/scratch/work/simon/finnish_newspapers/models$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gensim
>>> model = gensim.models.Word2Vec.load("model_fi_1880.bin")
>>> model.wv.most_similar("kirjasto")
[('lukusali', 0.8510360717773438), ('lirjasto', 0.8264331817626953), ('tirjasto', 0.7902065515518188), ('lainakirjasto', 0.7628928422927856), ('luknsali', 0.7343387603759766), ('lulusali', 0.7339579463005066), ('lutusali', 0.7185679078102112), ('kansankirjasto', 0.7182174324989319), ('lukutupa', 0.6950151920318604), ('kirjast', 0.6868242621421814)]
>>> exit()
cloud-user@dhh17:/scratch/work/simon/finnish_newspapers/models$ R
@drvenabili
drvenabili / diff.py
Created October 11, 2018 13:23
diff 70-60
Difference between 60 and 70: {'6.297', 'candles', 'third-rate', 'completer', 'axpb', '174.evolution', 'incongruously', 'soaked', '21.0..1.1', '6.546', 'surmountable', '8.97', '351.velian', 'self-benefactors', 'geographical', 'swell', '482.to', "v'-s'v", '5.373', '469.every', '3.142', 'imposition', 'correctorium', '2.611', '~k+h', 'glee', 'x-ae', '.á.a', 'hessians', 'symbolon', 'durations', '149.according', '340.the', 'stecheology', 'signatures', '300,000,000', '7.472', 'subjectivist', '590.if', 'kantianism', '57.the', '631.the', 'buddhisto-christian', '5.430', '261.eighth', '2.88', '4.436', 'leader-writer', 'racer', '518.pragmaticism', 'apagoge', '6.22', 'non-success', '819,539', 'engendered', '529', 'decreasing', 'semi-clerical', '324.it', '..1-a2..1-b2c+a..1-c2', '123.the', 'illuminates', 'inconsiderate', 'avogadro', '3.from', 'willkŸhrliche', '187.in', '0.50', '-ii', 'photometrics', 'christiana', '0.1111', 'filason', '73.', '3.406', 'buys', '168.however', 'barest', '8.227', '1.662', 'spade-suit', 'permiss
@drvenabili
drvenabili / gensim_word2vec_procrustes_align.py
Last active October 26, 2019 12:21 — forked from quadrismegistus/gensim_word2vec_procrustes_align.py
Code for aligning two gensim word2vec models using Procrustes matrix alignment. Code ported from HistWords <https://github.com/williamleif/histwords> by William Hamilton <[email protected]>.
## This is a copy for backup purposes. The original GitHub gist by Ryan Heuser is available at https://gist.github.com/quadrismegistus/09a93e219a6ffc4f216fb85235535faf .
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 <[email protected]>.
(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.
hengchen@LM7-HUMTDK-02  ~/git/seed-semantic-change/src/dynamic-senses   master ●  ./aest_non_aesth.sh
./greek_input/aesth_non_aesth/all_corpora/aesth_113388.txt
./greek_input/aesth_non_aesth/targets_113388.txt
5
28884 bytes successfully written to file
correct case for test likelihood
open : no such file or directory
invalid argument
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x10dc0de]
import numpy as np
import matplotlib.pyplot as plt
valeurs = {"p1":[0.4, 0.55, 0.05, 0.0], "p2":[0.2, 0.3, 0.5, 0.0], "p3":[0.4, 0.2, 0.2, 0.2], "p4":[0.2, 0.2, 0.2, 0.4], "p5":[0.4, 0.55, 0.05, 0.0], "p6":[0.4, 0.55, 0.05, 0.0], "p7":[0.4, 0.55, 0.05, 0.0]}
colours = ['b','g','r','c','m','y','k']
valeurs2 = dict()
for key in valeurs.keys():
#print(key)
2017-09-18 15:14:46,932 INFO - Processing file '/home/sigmund/work/hartlib/OneDrive/lemmatization/cleaned_EN_input/9D_17_55_cleaned.xml' .
org.jdom2.input.JDOMParseException: Error on line 1: The reference to entity "c" must end with the ';' delimiter.
at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:232)
at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:303)
at org.jdom2.input.SAXBuilder.build(SAXBuilder.java:1196)
at edu.northwestern.at.morphadorner.corpuslinguistics.inputter.XMLTextInputter.doLoadText(XMLTextInputter.java:328)
at edu.northwestern.at.morphadorner.corpuslinguistics.inputter.XMLTextInputter.loadText(XMLTextInputter.java:415)
at edu.northwestern.at.morphadorner.MorphAdorner.adornXML(MorphAdorner.java:817)
at edu.northwestern.at.morphadorner.MorphAdorner.processInputFiles(MorphAdorner.java:718)
at edu.northwestern.at.morphadorner.MorphAdorner.main(MorphAdorner.java:2610)