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: https://superuser.com/a/1322187/71861 | |
No need to change anything in the /etc/security/limits.conf file, it is ignored if you are using systemd. | |
(reproducing a modified answer to another question on the network...) | |
An alternative for those who prefer not to edit the default /etc/systemd/system.conf and /etc/systemd/user/conf files: | |
create a new file /etc/systemd/system.conf.d/limits.conf with these contents: |
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
for pid in [0-9]*; do echo "PID = $pid with $(ls /proc/$pid/fd/ | wc -l) file descriptors"; done | sort -n -k5 |
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 __future__ import annotations | |
import argparse | |
from itertools import islice | |
import os | |
from pathlib import Path | |
from typing import List | |
import numpy as np | |
from PIL import Image |
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 ipywidgets import Image | |
from io import StringIO | |
import pydotplus | |
from sklearn.tree import export_graphviz | |
dot_data = StringIO() | |
export_graphviz(tree, feature_names=data.columns, | |
out_file=dot_data, filled=True) | |
graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) | |
Image(value=graph.create_png()) |
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
#include <iostream> | |
#include <memory> | |
struct A { | |
A(std::unique_ptr<int> ptr) { | |
std::cout << *ptr << std::endl; | |
} | |
}; |
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 __future__ import print_function | |
from sys import getsizeof, stderr | |
from itertools import chain | |
from collections import deque | |
try: | |
from reprlib import repr | |
except ImportError: | |
pass | |
def total_size(o, handlers={}, verbose=False): |
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 show_images(images, cols = 1, titles = None): | |
import matplotlib.pyplot as plt | |
import numpy as np | |
"""Display a list of images in a single figure with matplotlib. | |
Parameters | |
--------- | |
images: List of np.arrays compatible with plt.imshow. | |
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
import cProfile | |
import pstats | |
import marshal | |
import uuid | |
import functools | |
def _save_profiling(p): | |
try: | |
stats = pstats.Stats(p) |
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
#!/usr/bin/env python3 | |
import csv | |
import sys | |
import xml.sax | |
class StreamHandler(xml.sax.handler.ContentHandler): | |
def __init__(self, csvwriter): | |
super().__init__() |
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
#[derive(Debug, PartialEq)] | |
struct A { | |
x: i32, | |
} | |
fn main() { | |
let x = Box::new(A { x: 42 }); | |
let v = *x; | |
} |
NewerOlder