Skip to content

Instantly share code, notes, and snippets.

@cavit99
cavit99 / qwen2vl.py
Last active January 7, 2025 08:52
Qwen2-VL-7B-Instruct inference on Apple silicon
import torch
from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor
from PIL import Image
from pathlib import Path
import sys
# Toggle to switch between full response and extracted description
OUTPUT_FULL_RESPONSE = False
# Ensure we're using the MPS device if available
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active January 7, 2025 08:52
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@xiabingquan
xiabingquan / transformer_all_in_one.py
Created December 6, 2023 14:52
Implement Transformer from scratach. All modules included in one file!
# coding=utf-8
# Contact: [email protected]
import numpy as np
import torch
import torch.nn as nn
def get_len_mask(b: int, max_len: int, feat_lens: torch.Tensor, device: torch.device) -> torch.Tensor:
@Rodrigo54
Rodrigo54 / php-html-css-js-minifier.php
Last active January 7, 2025 08:48 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@eccegordo
eccegordo / intro-to-ember-cli-node.md
Created March 21, 2015 11:14
Introduction to Ember CLI, Node and NPM

Introduction To Node, NPM and Ember CLI

This guide is for developers who are new Node, NPM, and Ember CLI. This guide is designed to get you started with ember cli development and provide some general background info on what Node is and how it works with Ember CLI.

Overview

  • What is Node?
  • What is NPM?
  • How do I setup my environment if I don't have node js or npm installed?
  • I accidently installed something wrong how can I start over?
@Maharshi-Pandya
Maharshi-Pandya / contemplative-llms.txt
Last active January 7, 2025 08:52
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
@macshome
macshome / defang.md
Last active January 7, 2025 08:44
How to defang system protections on macOS

How to Defang macOS System Protections

If you want to change things on the root drive of a Mac you will need to take some steps to disable the built in security of the system. Most of these steps are the same regardless if you are on Intel or Apple Silicon. If there is a difference it is noted.

Note that all of these things put a Mac into an unsupported and less secure state.

Make sure you either perform these steps in a VM or that you reset the protections after you are done poking around

Protections and Terms

(This list is not exahustive on the details of each. Check the links at the end for more info.)

@martijnvermaat
martijnvermaat / __init__.py
Last active January 7, 2025 08:43
Matplotlib for use in LaTeX
import math
from matplotlib import rcParams
def configure(document_fontsize=14.4, available_width=307.28987):
"""
Configures Matplotlib so saved figures can be used in LaTeX documents.
Uses the sans-serif TeX Gyre Heros font (Helvetica), also for math.
@rsanden
rsanden / tun2socks_proxy_foo.bash
Last active January 7, 2025 08:43
tun2socks TCP+UDP user-wide proxy through shadowsocks and udpgw
#--- Build tun2socks and udpgw (as the user who will use the proxy) ---
mkdir -p $HOME/src
cd $HOME/src
git clone "https://github.com/ambrop72/badvpn"
cd badvpn
mkdir -p build
cd build
export OUTDIR=$PWD
export SRCDIR=$(dirname $PWD)
@EgorBron
EgorBron / discord-revive.md
Last active January 7, 2025 08:42
Восстанавливаем доступ к ДС с помощью Amnezia WG

Оживляем ДС

Быстрый способ (на ~10 минут) для разблокировки Discord вместе с голосовыми каналами. Этот способ также разблокирует YouTube и X/Twitter, а также любые другие заблокированные сайты.

Спасибо ImMAILWARE за скрипт для генерации конфигов.

Я рекомендую сразу перейти к способу с браузером, так как его относительно проще провернуть.

Способ с Linux