Skip to content

Instantly share code, notes, and snippets.

View andreabazerla's full-sized avatar
😀
Open to work

Andrea Bazerla andreabazerla

😀
Open to work
View GitHub Profile
@zrruziev
zrruziev / NUMA node problem.md
Last active June 10, 2024 20:36
Fixing "successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero" problem

What is NUMA (Non-Uniformed Memory Access)

Non-Uniform Memory Access (NUMA) is one of the computer memory design methods used in multiprocessor systems, and the time to access the memory varies depending on the relative position between the memory and the processor. In the NUMA architecture, when a processor accesses its local memory, it is faster than when it accesses the remote memory. Remote memory refers to memory that is connected to another processor, and local memory refers to memory that is connected to its own processor. In other words, it is a technology to increase memory access efficiency while using multiple processors on one motherboard. When a specific processor runs out of memory, it monopolizes the bus by itself, so other processors have to play. , and designate 'access only here', and call it a NUMA node.

1. Check Nodes

lspci | grep -i nvidia
  
01:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2060 12GB] (rev a1)
@FrankRuns
FrankRuns / uno-sim.ipynb
Last active January 16, 2024 10:18
Python sim for the card Uno
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tclements
tclements / sliding_window.py
Created March 14, 2019 22:14
Create a Sliding Window function (with steps) using NumPy.
# Create a function to reshape a 1d array using a sliding window with a step.
# NOTE: The function uses numpy's internat as_strided function because looping in python is slow in comparison.
# Adopted from http://www.rigtorp.se/2011/01/01/rolling-statistics-numpy.html and
# https://gist.github.com/codehacken/708f19ae746784cef6e68b037af65788
import numpy as np
# Reshape a numpy array 'a' of shape (x) to form shape((n - window_size) // step + 1, window_size))
def rolling_window(a, window, step):
shape = a.shape[:-1] + ((a.shape[-1] - window + 1)//step, window)
@s-mawjee
s-mawjee / check_gpu.py
Last active May 20, 2024 17:35
Get Nvidia GPU information via python code, instead of watching nvidia-smi in the terminal. Useful when training ML models, can be added to the training loop.
import nvidia_smi
_GPU = False
_NUMBER_OF_GPU = 0
def _check_gpu():
global _GPU
global _NUMBER_OF_GPU
nvidia_smi.nvmlInit()
_NUMBER_OF_GPU = nvidia_smi.nvmlDeviceGetCount()
@andreabazerla
andreabazerla / Observer.jsp
Last active February 22, 2018 08:48
Observer Design Pattern in ECMAScript 6
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Observer</title>
<script src="<c:url value="/resources/js/init.js" />"></script>
</head>
@scrapehero
scrapehero / zillow.py
Last active December 13, 2023 16:05
Python 3 script to find real estate listings of properties up for sale on zillow.com
from lxml import html
import requests
import unicodecsv as csv
import argparse
import json
def clean(text):
if text:
return ' '.join(' '.join(text).split())
var array = [];
var array2 = [];
for(var i=1;i<100;i++) {
array[i] = Math.random() < 0.50 ? 0 : 1;
}
array[0] = 0;
array[99] = 1;
@andreabazerla
andreabazerla / deg-to-px.php
Last active January 31, 2017 22:46
http://itsvr.altervista.org/ Script in PHP for your website to plot a GPS position on a custom map converting latitude and longitude from degrees to pixels.
<?php
// Demo: http://itsvr.altervista.org/
/* Square area edges in degrees of your custom area map (Verona, Italy) */
$mapLatTop = 45.47;
$mapLatBottom = 45.37;
$mapLonLeft = 10.92;
$mapLonRight = 11.06;
@andreabazerla
andreabazerla / twitter.js
Last active May 2, 2024 23:14
Simple script in JavaScript to like all tweets on Twitter to get more followers and establish a dictatorship
setInterval(function () {
window.scrollTo(0, document.body.scrollHeight);
$('.ProfileTweet-actionButton.js-actionButton.js-actionFavorite:visible').click();
}, 1000);