Skip to content

Instantly share code, notes, and snippets.

@blaylockbk
blaylockbk / multipro_template.py
Last active May 17, 2024 06:42
Template for Python multiprocessing and multithreading
import multiprocessing #:)
def do_this(number):
print number
return number*2
# Create a list to iterate over.
# (Note: Multiprocessing only accepts one item at a time)
some_list = range(0,10)
# This supports merging as many adapters as you want.
# python merge_adapters.py --base_model_name_or_path <base_model> --peft_model_paths <adapter1> <adapter2> <adapter3> --output_dir <merged_model>
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
import os
import argparse
@ervinne13
ervinne13 / add-view-in-new-tab
Created May 17, 2024 00:02
Adds a "View in New Tab" button in nahida.live/mods so that you don't need to register and convert base64s to get to the download page.
const elements = document.querySelectorAll(`.card`);
elements.forEach(element => {
const button = document.createElement('button');
button.innerText = 'View in New Tab';
button.className = 'custom-button';
button.onclick = function () {
const imgWithUUID = element.querySelector('figure > img');
const imgUrl = imgWithUUID.src
@kavishkagihan
kavishkagihan / java-ssti.md
Last active May 17, 2024 06:32
Java ssti payloads to read remote files and get RCE
  • Typically java ssti payloads start with $. But if that character is banned you can use * instead of that.

  • Get env vars

*{T(java.lang.System).getenv()}
  • Read files (/etc/passwd)
@gabe565
gabe565 / change-arc-icon.md
Last active May 17, 2024 06:32
Change Arc Browser Icon

Change Arc Browser Icon

arc

A collection of commands that change the Arc Browser icon on macOS.

Commands

Theme Command
Candy Arc defaults write company.thebrowser.Browser currentAppIconName candy
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 17, 2024 06:30
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@Adem68
Adem68 / flutter-project-line.md
Last active May 17, 2024 06:28
How many lines does your Flutter project have?
  • Open terminal and go to your project's lib folder. After that run the command below.
  • find . -name '*.dart' ! -name '*.g.dart' ! -name '*.freezed.dart' ! -name '*.gr.dart' ! -name '*.gen.dart' | xargs wc -l

Thanks @AcetylsalicylicAcid for excluding generated files.

@jimmywarting
jimmywarting / readme.md
Last active May 17, 2024 06:27
Cors proxies
Exposed headers
Service SSL status Response Type Allowed methods Allowed headers
@vegard
vegard / kernel-dev.md
Last active May 17, 2024 06:23
Getting started with Linux kernel development

Getting started with Linux kernel development

Prerequisites

The Linux kernel is written in C, so you should have at least a basic understanding of C before diving into kernel work. You don't need expert level C knowledge, since you can always pick some things up underway, but it certainly helps to know the language and to have written some userspace C programs already.

It will also help to be a Linux user. If you have never used Linux before, it's probably a good idea to download a distro and get comfortable with it before you start doing kernel work.

Lastly, knowing git is not actually required, but can really help you (since you can dig through changelogs and search for information you'll need). At a minimum you should probably be able to clone the git repository to a local directory.