Print without the first elemenet:
grep "type" * | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}' | grep "\"type\""
Print without the first elemenet:
grep "type" * | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}' | grep "\"type\""
| var PUNCTUATION = "" + | |
| "’'" + // apostrophe | |
| "()[]{}<>" + // brackets | |
| ":" + // colon | |
| "," + // comma | |
| "‒–—―" + // dashes | |
| "…" + // ellipsis | |
| "!" + // exclamation mark | |
| "." + // full stop/period | |
| "«»" + // guillemets |
watch -n5 nvidia-smiEvery 5.0s: nvidia-smi Thu Feb 10 16:12:32 2022
Thu Feb 10 16:12:32 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 495.29.05 Driver Version: 495.29.05 CUDA Version: 11.5 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| ``` | |
| brew install git-lfs | |
| git lfs install | |
| git lfs track "*.png" | |
| git lfs track path/to/some/folders/* | |
| ``` | |
| Make sure you commit the .gitattributes file. | |
| git add .gitattributes && git commit -m "Add Git LFS attribute dot file" && git push |
| # Sample PBS job script | |
| # | |
| # Copy this script, customize it and then submit it with the ``qsub'' | |
| # command. For example: | |
| # | |
| # cp pbs-template.sh myjob-pbs.sh | |
| # {emacs|vi} myjob-pbs.sh | |
| # qsub myjob-pbs.sh | |
| # | |
| # PBS directives are fully documented in the ``qsub'' man page. Directives |
| # nvm cache could get very large | |
| nvm cache clear |
| \definecolor{ashgrey}{rgb}{0.7, 0.75, 0.71} | |
| \begin{lstlisting}[firstnumber=1] | |
| 'use strict'; | |
| const common = require('../common'); | |
| ... | |
| \end{lstlisting} | |
| \vspace{-\baselineskip} | |
| \begin{lstlisting}[firstnumber=10, backgroundcolor=\color{ashgrey}] | |
| function main({ len, n }) { |
| # remove lage files from commit history | |
| git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD | |
| git push origin --force --all | |
| # git commit in the past | |
| git commit --date="5 day ago" -m "Your commit message" | |
| # setup credential.helper store | |
| $ git config credential.helper store |
| # search for web apps with open api | |
| curl https://api.github.com/search/repositories\?q\=web+apps+openapi\&type\=Repositories | grep html_url | awk '{print $2}' |
I recently came across the need to spawn multiple threads, each of which needs to write to the same file. Since the file will experience contention from multiple resources, we need to guarantee thread-safety.
NOTE: The following examples work with Python 3.x. To execute the following programs using Python 2.7, please replace threading.get_ident() with thread.get_ident(). As a result, you would need to import thread and not threading.
# threading_lock.py
import threading