Skip to content

Instantly share code, notes, and snippets.

View sureshg's full-sized avatar
🚀
☕️

Suresh sureshg

🚀
☕️
View GitHub Profile
@sureshg
sureshg / index.http
Created July 20, 2023 03:55 — forked from linux-china/index.http
Run Llama-2-13B-chat RESTful server locally on your M1/M2/Intel Mac with GPU inference.
### Llama 2 Chat
POST http://127.0.0.1:8080/completion
Content-Type: application/json
{
"prompt": "What is Java Language?",
"temperature": 0.7
}
### Llama 2 tokenize
@sureshg
sureshg / FFMCrash.java
Created May 9, 2023 01:19
FFM API crash
#!/usr/bin/env java --enable-preview --enable-native-access=ALL-UNNAMED --source 21
import java.lang.foreign.*;
import java.lang.foreign.MemoryLayout.PathElement;
import java.lang.invoke.MethodHandle;
public class FFMCrash {
static Linker LINKER = Linker.nativeLinker();
static SymbolLookup loaderLookup = SymbolLookup.loaderLookup();
@sureshg
sureshg / vega_lite.json
Last active April 26, 2023 22:45
Vegalite Viz for cpu/memory usage
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A dual axis chart, created by setting y's scale resolution to `\"independent\"`",
"width": 400,
"height": 300,
"data": {
"values": [
{
"process": "java",
"time": "2023-04-27 00:00:00",
@sureshg
sureshg / GituhubActionEnv.kt
Created November 11, 2022 03:01
Github Action Envs
fun main() {
"""
CI=Always set to true.
GITHUB_ACTION=The name of the action currently running, or the id of a step. For example, for an action, __repo-owner_name-of-action-repo. GitHub removes special characters, and uses the name __run when the current step runs a script without an id. If you use the same script or action more than once in the same job, the name will include a suffix that consists of the sequence number preceded by an underscore. For example, the first script you run will have the name __run, and the second script will be named __run_2. Similarly, the second invocation of actions/checkout will be actionscheckout2.
GITHUB_ACTION_PATH=The path where an action is located. This property is only supported in composite actions. You can use this path to access files located in the same repository as the action. For example, /home/runner/work/_actions/repo-owner/name-of-action-repo/v1.
GITHUB_ACTION_REPOSITORY=For a step executing an action, this is the owner and repository name of the action. Fo
@sureshg
sureshg / renew-gpgkey.md
Created June 10, 2022 16:58 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@sureshg
sureshg / Deps.kt
Last active March 25, 2023 19:34 — forked from mcpiroman/build.gradle.kts
BuildSrc Dependencies
import org.gradle.kotlin.dsl.*
import org.gradle.plugin.use.*
import org.slf4j.LoggerFactory
/** Build source logger */
val logger = LoggerFactory.getLogger("build-logic")
/** Dependency versions. */
object Deps {
@sureshg
sureshg / latency.txt
Created June 16, 2020 19:29 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@sureshg
sureshg / openssl_commands.md
Created February 18, 2020 19:26 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@sureshg
sureshg / Regex.md
Last active July 13, 2018 06:27
Catastrophic Backtracking
@sureshg
sureshg / convert to pkcs 8.md
Created June 20, 2018 18:10 — forked from markscottwright/convert to pkcs 8.md
How to convert a java private key from PKCS#1 encoding to PKCS#8

I had some historical key material data in pkcs#1 format that needed to be in pkcs#8 for input into another system. Here's how to do it, using BouncyCastle:

import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.DERObject;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import java.security.PrivateKey;