Skip to content

Instantly share code, notes, and snippets.

@ZhangHongQuan-Dianrong
ZhangHongQuan-Dianrong / gdbmalloc.py
Created October 30, 2017 11:58
show ptmalloc memory management using gdb+python
# -*- encoding:utf-8 -*-
# malloc.py is an extension for gdb to inspect memory allocation and free
#
import sys
import struct
from contextlib import contextmanager
import os.path
#in pthon 2.6, this is only what I can get
from optparse import OptionParser
@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