Skip to content

Instantly share code, notes, and snippets.

View mmtechslv's full-sized avatar
Coding

Farid MUSA mmtechslv

Coding
View GitHub Profile
@linderd
linderd / README.md
Last active March 13, 2024 19:06 — forked from timlinux/README.md
Linux on Thinkpad P14s Gen2 AMD / T14 Gen2 AMD

Linux (Fedora 35) on a Thinkpad P14s [T14] Gen2 AMD

These are my installation-tricks and notes for running Linux on a 2021 Thinkpad P14s Gen2 with AMD Ryzen 7 5850U. It should also be suitable for the Thinkpad T14 Gen2 AMD as they are technically the same modell.
Meanwhile there is also a good test on youtube and an entry in the arch-wiki, which also comments some points mentioned here.

Detailed specs

Shipped:

@vtrifonov-esfiddle
vtrifonov-esfiddle / cloud-init.yaml
Last active January 5, 2024 17:42
cloud-init config for ubuntu host with docker & docker-compose
#cloud-config
groups:
- docker
users:
- default
# the docker service account
- name: docker-service
groups: docker
package_upgrade: true
packages:
@reillysiemens
reillysiemens / signing-vbox-kernel-modules.md
Last active April 30, 2024 13:56
Signing VirtualBox Kernel Modules

Signing VirtualBox Kernel Modules

These are the steps I followed enable VirtualBox on my laptop without disabling UEFI Secure Boot. They're nearly identical to the process described on [Øyvind Stegard's blog][blog], save for a few key details. The images here are borrowed from the [Systemtap UEFI Secure Boot Wiki][systemtap].

  1. Install the VirtualBox package (this might be different for your platform).
    src='https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo'
@aussielunix
aussielunix / aws_nvme-cloud-init.yml
Last active September 21, 2021 00:07
simple cloud-init for mounting an ephemeral nvme store in AWS. This is to be used as user-data.
#cloud-config
repo_update: true
repo_upgrade: all
package_upgrade: true
bootcmd:
- test -z "$(blkid /dev/nvme0n1)" && mkfs -t ext4 -L scratch /dev/nvme0n1
mounts:
@esseti
esseti / checkbox.html
Created March 30, 2018 15:27
Beautiful widget for django multiple select
{% with id=widget.attrs.id %}
{% for group, options, index in widget.optgroups %}
{% for option in options %}
{% with widget=option %}
{% include widget.template_name%}
{% endwith %}
{% endfor %}
{% endfor %}
{% endwith %}
@peterhurford
peterhurford / pytest-fixture-modularization.md
Created July 28, 2016 15:48
How to modularize your py.test fixtures

Using py.test is great and the support for test fixtures is pretty awesome. However, in order to share your fixtures across your entire module, py.test suggests you define all your fixtures within one single conftest.py file. This is impractical if you have a large quantity of fixtures -- for better organization and readibility, you would much rather define your fixtures across multiple, well-named files. But how do you do that? ...No one on the internet seemed to know.

Turns out, however, you can define fixtures in individual files like this:

tests/fixtures/add.py

import pytest

@pytest.fixture
@mpetroff
mpetroff / jail.local
Last active December 19, 2023 12:06
JupyterHub PAM Authentication Fail2ban Configuration
# /etc/fail2ban/jail.local
[jupyterhub]
enabled = true
port = 443
filter = jupyterhub
backend = systemd
maxretry = 6
#cloud-config
---
coreos:
fleet:
public-ip: "$public_ipv4"
units:
- name: flanneld.service
drop-ins:
- name: 50-network-config.conf
content: |
@Zearin
Zearin / python_decorator_guide.md
Last active March 30, 2024 12:28
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@vdboor
vdboor / catalogue | models.py
Last active February 25, 2021 12:29
A quick overview how to combine django-parler with django-oscar. This assumes you are familliar with the "Customising Oscar" topics (https://django-oscar.readthedocs.org/en/latest/topics/customisation.html). A screenshot of the integration was shown at DjangoConEU 2014 (http://django-fluent.org/blog/2014/05/lightning-talk-djangocon-eu-2014/)
from oscar.apps.catalogue.abstract_models import AbstractProduct,
from parler.models import TranslatableModel, TranslatedFields
class Product(AbstractProduct, TranslatableModel):
"""
Add translations to the product model.
"""
# Provide translated fields.