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
| """Hacky script to occupy and then release RAM in order to flush disk cache (easier to run this than annoy the sysadmin to run `sync`).""" | |
| import psutil | |
| import gc | |
| from tqdm import tqdm | |
| def get_available_ram(): | |
| """ | |
| Get the total available RAM in bytes. |
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
| DRAWIO = /Applications/draw.io.app/Contents/MacOS/draw.io | |
| INKSCAPE = /Applications/Inkscape.app/Contents/MacOS/inkscape | |
| DIR = . | |
| INPUTS = $(wildcard $(DIR)/*.drawio) | |
| OUTPUTS = $(INPUTS:.drawio=.png) | |
| .PHONY : all | |
| all : $(OUTPUTS) |
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
| #!/bin/bash | |
| for i in $(nvidia-smi --query-gpu=index --format=csv,noheader); do | |
| echo GPU "#$i": $(nvidia-smi --query-gpu=memory.used --format=csv,noheader -i $i) used | |
| while IFS="," read -r pid name used; do | |
| pid_container_name= | |
| for container in $(docker ps -q); do | |
| if [[ $(docker top $container | awk '{print $2}'| grep $pid) ]]; then | |
| pid_container_name=$(docker inspect $container --format '{{.Name}}') |
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
| #/bin/bash | |
| if [ -z "$1" ] | |
| then | |
| echo "Supply a PID as an argument!" | |
| exit 1 | |
| fi | |
| for i in $(docker ps -q) | |
| do |
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
| from functools import wraps, partial | |
| import inspect | |
| def _ify(func, factory=list): | |
| if inspect.isasyncgenfunction(func): | |
| @wraps(func) | |
| async def new_func(*args, **kwargs): | |
| return factory([x async for x in func(*args, **kwargs)]) | |
| else: |
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
| let merge = (array1, array2) => { | |
| let output = []; | |
| while (array1.length != 0 && array2.length != 0) { | |
| if (array1[0] == array2[0]) { | |
| output.push(array1[0]); | |
| array1 = array1.slice(1, array1.length); | |
| output.push(array2[0]); | |
| array2 = array2.slice(1, array2.length); | |
| } else { | |
| if (array1[0] < array2[0]) { |
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
| git config --global http.proxy http://<proxy>:3128 | |
| git config --global https.proxy http://<proxy>:3128 |
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
| .non-selectable { | |
| -webkit-touch-callout: none; | |
| -webkit-user-select: none; | |
| -khtml-user-select: none; | |
| -moz-user-select: none; | |
| -ms-user-select: none; | |
| user-select: none; | |
| cursor: default; | |
| } |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.ComponentModel; | |
| using System.Data; | |
| using System.Drawing; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using System.Windows.Forms; | |
| using System.Drawing.Drawing2D; |
NewerOlder