Skip to content

Instantly share code, notes, and snippets.

@kyo-takano
kyo-takano / making-the-most-of-local-llms.ipynb
Last active May 4, 2024 15:12
ローカルLLMはこーやって使うの💢
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import sys
import struct
import binascii
from collections import Counter
def u16(b):
return struct.unpack('<H', b)[0]
def p16(x):
return struct.pack('<H', x)
def p32(x):
@leocomelli
leocomelli / git.md
Last active May 4, 2024 15:12
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda

#!/bin/bash
clear
echo "$COL_GREEN Radius Manager installer script for CENTOS 6.x 32bit"
echo "Copyright 2004-2013, DMA Softlab LLC"
echo "All right reserved.. $COL_RESET"
echo "$COL_GREEN Script modified by Syed Jahanzaib for CENTOS"
# Colors Config . . . [[ JZ . . . ]]
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
@konstantin24121
konstantin24121 / verifyTelegramWebAppData.tsx
Last active May 4, 2024 15:09
Telegram Bot 6.0 Validating data received via the Web App node implementation
const TELEGRAM_BOT_TOKEN = '110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw'; // https://core.telegram.org/bots#creating-a-new-bot
export const verifyTelegramWebAppData = async (telegramInitData: string): boolean => {
// The data is a query string, which is composed of a series of field-value pairs.
const encoded = decodeURIComponent(telegramInitData);
// HMAC-SHA-256 signature of the bot's token with the constant string WebAppData used as a key.
const secret = crypto
@mvaisakh
mvaisakh / Bringup.md
Last active May 4, 2024 15:08
An Android Device Tree Bringup Guide

A small Device Tree Bringup Guide

Introduction

So, you guys might be wondering, how do these "Developers" get your favourite Custom roms, such as LineageOS, Paranoid Android etc., to their own devices. Well I'm here to Guide you on how to do it, specifically on how to bringup or make your own device tree from scratch or adapting.

Gist of this Guide: This is for people with genuine interest in Android OS porting/development. After going through this guide, you should be able to do a total device tree bringup on your own.

Prerequisite: Certain requirements are to be met before you start with this amazing journey.

@mid-kid
mid-kid / pdf-full-merge.js
Created October 18, 2023 21:39
Merge all attributes of multiple PDF files using MuPDF
// Merge all attributes of multiple PDF files (pdf-full-merge.js)
// Extended from MuPDF's docs/examples/pdf-merge.js
// Ever had problems with tools that don't copy certain attributes of a PDF?
// This script uses MuPDF to merge/join/concatenate as much as possible, including:
// - bookmarks / outlines / table of contents
// - link attributes of said outlines, such as viewrect and zoom
// - whether outlines appear open or closed by default
// - annotations
// - 3d objects / PDF3D
@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active May 4, 2024 15:07
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@luqmanyusof
luqmanyusof / TM1637Basic.cpp
Created February 9, 2022 05:06
TM1637 without library
#define CLK 26
#define DIO 27
#include <Arduino.h>
uint8_t digits[] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f };
void start(void)
{
digitalWrite(CLK,HIGH);//send start signal to TM1637
digitalWrite(DIO,HIGH);
@rLinks234
rLinks234 / mmap_exec_ex1.cpp
Created January 31, 2017 06:09
Memory map executable code boilerplate (with mmap)
///
/// Author: Daniel Wright
///
/// Linux compile:
/// ${CC} -fPIC -fpie -std=c++14 -fno-exceptions -fno-rtti -lstdc++ -lm -lc -ldl mmap_exec_ex1.cpp -o mmap_exec_ex1
///
/// Tested on Android 7.1.1 (x86 emulator), as well as Ubuntu 16.04 (Core i5 3570k [targeting x64] using kernel 4.4.0-59)
#include <dlfcn.h>
#include <stdint.h>