Skip to content

Instantly share code, notes, and snippets.

View kostasx's full-sized avatar
💭
Uncaught ReferenceError

Kostas Minaidis kostasx

💭
Uncaught ReferenceError
View GitHub Profile
@kostasx
kostasx / Ollama.CLI.tricks.md
Created August 24, 2024 21:50
Ollama Command Line Tricks (YouTube: https://youtu.be/7mw792o1sSg)
  • Input from stdin

    • ollama run llama3.1 "prompt"
  • Multiline input

    • Using """
  • Input from file

    • Using the pipe | operator:
      • cat fox.txt | ollama run llama3.1 "Please translate the provided text to German"
  • Using the redirection operator < :

@kostasx
kostasx / llm.sh
Created August 12, 2024 20:54
What is Ollama? (YouTube video: https://www.youtube.com/watch?v=0n3D2nNq7AE)
function llm(){
question="'$*'"
curl http://localhost:11434/api/generate --silent --data '{
"model": "llama3",
"prompt": "Answer in as few words as possible. Use a brief style with short replies. q '"$question"' ?",
"stream": false
}' | python -c "import sys, json; print(json.load(sys.stdin)['response'])"
@kostasx
kostasx / crypto-aes-gcm.js
Created July 11, 2024 21:59 — forked from chrisveness/crypto-aes-gcm.js
Uses the SubtleCrypto interface of the Web Cryptography API to encrypt and decrypt text using AES-GCM (AES Galois counter mode).
/**
* Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt().
* (c) Chris Veness MIT Licence
*
* @param {String} plaintext - Plaintext to be encrypted.
* @param {String} password - Password to use to encrypt plaintext.
* @returns {String} Encrypted ciphertext.
*
* @example
* const ciphertext = await aesGcmEncrypt('my secret text', 'pw');
@kostasx
kostasx / float_bug.js
Created May 13, 2024 23:25 — forked from lsloan/float_bug.js
JavaScript floating point math bug example
/*
* Demonstrate JavaScript floating point math bugs by showing
* which two-decimal-place numbers between 0.00 and 1.00 inclusive
* have fractional parts after being multiplied by one hundred.
*/
var i = 0.00;
for (n = 0; n <= 100; ++n) {
j = i * 100;
if (Math.round(j) != j) {
@kostasx
kostasx / 1.Basic-Type.txt
Created May 6, 2024 16:40 — forked from QuocCao-dev/1.Basic-Type.txt
Typescript Exercises
/* *-*-*-*-*-*-*-*-*-*-* Challenge 1 ------------------
Create a variable with the type number and assign it an arbitrary value
*/
// ----------------------------------------------------
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// ----------------------------------------------------
/* *-*-*-*-*-*-*-*-*-*-* Challenge 2 ------------------
Create a variable with the type string and use the addition operator to put two arbitrary words together
*/
@kostasx
kostasx / gist:4511e2b57394f3cf2a404a7f4304e790
Last active December 13, 2023 11:51
Cohort0x02-13.12.2023
<section data-background-transition='zoom' data-transition='concave' data-background='http://ryanjarvinen.com/presentations/shared/img/broadcast_reveal_dark.png' data-state='blackout'>
<h2>Gist-Powered</h2>
<h1>Reveal.js</h1>
<h2>Slideshow Presentations</h2>
<br/>
<h1 class='fragment grow'><a style='color:deepskyblue;' href='http://gist-reveal.it'>gist-reveal.it</a></h1>
</section>
<section data-markdown>
<textarea data-template>
## Welcome!
@kostasx
kostasx / git_submodules.md
Created December 1, 2023 11:15 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@kostasx
kostasx / linux_bash.md
Created July 21, 2023 19:05 — forked from ldong/linux_bash.md
linux and bash notes I took on LFS101x from EDX LinuxFoundationX

Linux and Bash

Lets talk about Linux and Bash.

Notes

Notes were taken from edx.org of LFS101x Introduction to Linux.

Date: Sun Sep 28 00:30:48 EDT 2014

@kostasx
kostasx / remove-node-modules.md
Created June 19, 2023 14:41 — forked from lmcneel/remove-node-modules.md
How to remove node_modules after they have been added to a repo

How to remove node_modules

Create a .gitignore file

  1. Check for an existing .gitignore file in the project directory
ls -a