Skip to content

Instantly share code, notes, and snippets.

View orhun's full-sized avatar
⚙️
reinventing the wheel...

Orhun Parmaksız orhun

⚙️
reinventing the wheel...
View GitHub Profile
@thesamesam
thesamesam / xz-backdoor.md
Last active May 28, 2024 17:33
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Background

On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that

@OrionReed
OrionReed / dom3d.js
Last active May 27, 2024 22:42
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@srd424
srd424 / fzf_readline.c
Created September 9, 2023 10:54
Terrible hack for preloading custom readline functions
/* gcc -Wall -fPIC -shared -o fzf_readline.so fzf_readline.c -ldl */
/* a much nastier version of https://github.com/lincheney/rl_custom_function,
* but works with readline in Debian/Ubuntu
*/
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
@andrewrk
andrewrk / build.zig
Created February 20, 2023 16:20
sprinkling a little zig into a C project to help with debugging
const std = @import("std");
pub fn build(b: *std.Build) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard optimization options allow the person running `zig build` to select
@hnakamur
hnakamur / bounded_array_example.zig
Created February 17, 2023 23:55
Zig BoundedArray example
// Zig version: 0.10.1
// Import the standard library.
const std = @import("std");
// Define MyBoundedArray type.
const maxLength = 32;
const MyBoundedArray = std.BoundedArray(u8, maxLength);
/// Takes a slice as a parameter and fills it with a message.
#!/usr/bin/env bash
(
for lib in $(pacman -Qql openssl | grep -o '[^/]*.so$'); do
for repo in core extra community testing community-testing multilib multilib-testing staging community-staging multilib-staging gnome-Unstable kde-unstable; do
sogrep $repo $lib
done
done
) | sort -u
@binji
binji / LICENSE
Last active May 27, 2024 00:44
pokegb.cc w/o macros
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
@giuliano-macedo
giuliano-macedo / download_file.rs
Last active January 25, 2024 08:52
Download large files in rust with progress bar using reqwest, future_util and indicatif
// you need this in your cargo.toml
// reqwest = { version = "0.11.3", features = ["stream"] }
// futures-util = "0.3.14"
// indicatif = "0.15.0"
use std::cmp::min;
use std::fs::File;
use std::io::Write;
use reqwest::Client;
use indicatif::{ProgressBar, ProgressStyle};
@clickwir
clickwir / cool.sh
Last active April 10, 2021 20:18 — forked from orhun/cool.sh
Random MOD player
#!/usr/bin/env bash
# Get a random music file from modarchive.org and play it.
# Uses VLC. Many other players could work too.
# Check for needed programs. Exit if they are not found.
#if ! which xmp > /dev/null; then echo "xmp not installed. Try: apt install xmp"; exit 1; fi
if ! which vlc > /dev/null; then echo "VLC not installed. Try: apt install vlc"; exit 1; fi
if ! which curl > /dev/null; then echo "curl not installed. Try: apt install curl"; exit 1; fi
# Check if the user wants a specific module
@vaibhav93
vaibhav93 / auto_brightness.py
Last active August 11, 2020 23:16
Adjust brightness when switching to chrome workspace in i3
import i3ipc
import os
SET_BRIGHTNESS = 'xbacklight -set '
GET_BRIGHTNESS = 'xbacklight'
i3 = i3ipc.Connection()
class BrightnessController:
def __init__(self):
self.brightness_map = {}