Skip to content

Instantly share code, notes, and snippets.

View samyk's full-sized avatar

samy kamkar samyk

View GitHub Profile
@cedrickchee
cedrickchee / llama-7b-m1.md
Last active February 17, 2025 02:24
4 Steps in Running LLaMA-7B on a M1 MacBook with `llama.cpp`

4 Steps in Running LLaMA-7B on a M1 MacBook

The large language models usability

The problem with large language models is that you can’t run these locally on your laptop. Thanks to Georgi Gerganov and his llama.cpp project, it is now possible to run Meta’s LLaMA on a single computer without a dedicated GPU.

Running LLaMA

There are multiple steps involved in running LLaMA locally on a M1 Mac after downloading the model weights.

#define _WIN32_WINNT 0x0502
#define WINVER 0x0502
#include <windows.h>
#include <errhandlingapi.h>
#include <process.h>
#include "beacon.h"
WINBASEAPI PVOID WINAPI KERNEL32$AddVectoredExceptionHandler (ULONG First, PVECTORED_EXCEPTION_HANDLER Handler);
DECLSPEC_IMPORT uintptr_t __cdecl MSVCRT$_beginthreadex(void *_Security,unsigned _StackSize,_beginthreadex_proc_type _StartAddress,void *_ArgList,unsigned _InitFlag,unsigned *_ThrdAddr);
DECLSPEC_IMPORT void __cdecl MSVCRT$_endthreadex(unsigned _Retval);
484e4f4a403f52430039200c50affaac00000137738aea3e0000017f0700001400023e000a140003070001140002413d000d0211020811000143011400024111000242021102000700024301340009110201070003133232421102023a07000426423e0004140001413d004111021007000507000644024a12000711020312000843013400250205000000933b0111020312000b323400111102043a0700042633000611020412000c4301424108421100014a120009430007000a254211020544004a12000d4300421100013a070004253400051100010225470004070000421100013a07000e2547001011000147000607000f45000307001042110001421100023247000607001114000207000014000311000114000411000403002947002e1100031100021102064a1200121102064a12001343001100021200141a430113181700033549170004204945ffc91100034205000000003b0114010f05000000273b00140109050000003d3b0014010b05000000463b0014010a05000000a13b0014010c05000000ad3b0114010d05000000e33b0214010e0842001500204a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a1103066c4f4f7343420d6c06034a4d405f490c48434f59414942586143484909594248494a454249480b4f43425f585e594f58435e01450458495f580b64786160
@robinst
robinst / twitter-archive-following-followers.md
Last active July 23, 2025 03:41
Twitter: How to archive your following/followers data (usernames, etc)

Twitter allows users to download parts of their data, see How to download your Twitter archive.

But what's not included in that data dump is the usernames/handles of the people that you follow or are following you. All you get is account IDs which is just an internal number and so a bit useless when it comes to archival.

Here's a way to get that data (you need to know how to run stuff in the terminal):

  1. Go to your Twitter profile in a desktop browser (Firefox or Chrome)
  2. Right click on page → Inspect → Network tab
  3. Click on the Following link (e.g. https://twitter.com/{yourusername}/following)
@Spirit532
Spirit532 / 1InficonBPG400.cpp
Last active July 11, 2024 20:09
Simple ESP8266/Arduino program to fully read and interact with the Inficon BPG400 vacuum gauge via RS232. Uses an SSD1306 128x32 display to show the reading and miscellaneous things, the on-board boot pin button to turn on degassing, and an SPDT switch to change between measurement units.
/*
BPG-400 gauge reader
Copyright 2022 Andrey T.
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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWAR
@terjanq
terjanq / README.md
Last active June 28, 2025 23:51
Postviewer challenge writeup from GoogleCTF 2022

Postviewer - writeup

Challenge's overview

The rumor tells that adm1n stores their secret split into multiple documents. Can you catch 'em all? https://postviewer-web.2022.ctfcompetition.com

The challenge consisted of an all client-side simple page, i.e. no backend code was involved. A user can upload any file which will be then locally stored in indexedDB. They can preview their files by either clicking on the title or by visiting file's URL, for example https://postviewer-web.2022.ctfcompetition.com/#file-01d6039e3e157ebcbbf6b2f7cb2dc678f3b9214d. The preview of the file is rendered inside a blob created from data: URL. The rendering occurs by sending file's contents to the iframe via postMessage({ body, mimeType }, '*')

Additionally, there is a /bot endpoint which lets players send URLs to an xss-bot imitating another user. The goal is to steal their documents.

@avisek
avisek / colorConversions.js
Last active July 8, 2025 07:27
RGB, HSL, XYZ, LAB, LCH color conversion algorithms in JavaScript
/**
* Color conversion algorithms (RGB, HSL, XYZ, LAB, LCH)
* Derived from jQuery Color Picker Sliders by István Ujj-Mészáros
* Licensed under the Apache License 2.0
* https://github.com/istvan-ujjmeszaros/jquery-colorpickersliders
*/
export function rgbToHsl(rgb) {
const r = rgb.r / 255
const g = rgb.g / 255
@m1stadev
m1stadev / generator-apnonce.md
Last active January 19, 2025 10:30
Short guide on how to get a generator-apnonce pair for A12+ iOS devices (both jailbroken and non-jailbroken).

What's nonce entanglement?

Beginning with devices using an A12 SoC or higher, Apple introduced nonce entangling.

  • This meant that, when saving SHSH blobs, a nonce generator would generate a different ApNonce for each device.
  • When saving SHSH blobs for an A12+ device, you now must find a generator-ApNonce pair for your device, then use that generator-ApNonce pair when saving SHSH blobs.
  • After you have found a generator-ApNonce pair for your device, you can save it and re-use it whenever you save SHSH blobs again.

Getting a generator-ApNonce pair (jailbroken)

  1. (iOS 14+ only) Install an iOS kernel r/w library.
    • On Taurine, install libkernrw.
  • On unc0ver, install libkrw.
@StevenMasini
StevenMasini / ContentViewModel.swift
Created August 23, 2021 06:35
Multi Nearby Interaction
import Foundation
import NearbyInteraction
import MultipeerConnectivity
import Combine
var numberFormatter: NumberFormatter {
let numberFormatter = NumberFormatter()
numberFormatter.roundingMode = .halfEven
numberFormatter.maximumFractionDigits = 3
numberFormatter.minimumFractionDigits = 3