This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# A minimalist Gemini implementation for Terminal | |
# Ask Gemini from the command line. | |
# | |
import sys | |
import os | |
import pathlib | |
import textwrap | |
import google.generativeai as genai |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install homebrew - package manager | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
# add home brew to the PATH | |
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile | |
# Oh-my-ssh | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
# Add cask for unstable version (alpha, beta, nighly) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2023 Cedric Ferry. | |
SPDX-License-Identifier: Apache-2.0 */ | |
class MainActivity : ComponentActivity() { | |
// activity top level interception of the keyboard events | |
override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean { | |
val ctrl_w = KeyShortcut(KeyEvent.KEYCODE_W, ctrl = true) | |
val ctrl_r = KeyShortcut(KeyEvent.KEYCODE_R, ctrl = true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright 2023 Cedric Ferry. | |
# SPDX-License-Identifier: Apache-2.0 | |
# Gcore labs authentication with API Permanent Token | |
# Make sure you set "APIKey" in the Authorization header | |
# Get your {TOKEN} here: https://accounts.gcore.com/profile/api-tokens | |
# Get your {id} here: https://cdn.gcore.com/resources/list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* immersiveExperience for Android | |
* set your app into immersive mode hidding navigation and status bar | |
* call this function in Activity#onCreate | |
*/ | |
private fun immersiveExperience() { | |
val windowInsetsController = | |
WindowCompat.getInsetsController(window, window.decorView) | |
// Configure the behavior of the hidden system bars. | |
windowInsetsController.systemBarsBehavior = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2023 Cedric Ferry. | |
SPDX-License-Identifier: Apache-2.0 */ | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.border | |
import androidx.compose.foundation.gestures.detectDragGestures | |
import androidx.compose.foundation.layout.Box |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2023 Cedric Ferry. | |
SPDX-License-Identifier: Apache-2.0 */ | |
import android.view.Window | |
import androidx.core.view.ViewCompat | |
import androidx.core.view.WindowCompat | |
import androidx.core.view.WindowInsetsCompat | |
import androidx.core.view.WindowInsetsControllerCompat | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set backspace=2 " allow backspacing over everything in insert mode | |
set history=50 " keep 50 lines of command line history | |
set ignorecase " search commands are case-insensitive | |
set incsearch " while typing a search command, show matches incrementally | |
" instead of waiting for you to press enter | |
set ruler " show the cursor position all the time | |
set viminfo='20,\"50 " read/write a .viminfo file, don't store more than 50 lines of registers | |
set encoding=utf8 " non-ascii characters are encoded with UTF-8 by default | |
set formatoptions=croq " c=autowrap comments, r=continue comment on <enter>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/src/kotlin/collections/Collections.kt | |
/** | |
* Returns the index of the last item in the list that match predicate | |
* @param predicate function returning boolean for matching element. | |
* | |
* @return the index of the last element found | |
* otherwise returns -1 | |
*/ | |
public inline fun <T> List<T>.findLastIndex(predicate: (T) -> Boolean): Int { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2023 Google. | |
SPDX-License-Identifier: Apache-2.0 */ | |
@Composable | |
fun hoverableHighlightAndPointer() { | |
val highlightIndication: Indication = remember { | |
HighlightIndication() | |
} | |
val interactionSource = MutableInteractionSource() |
NewerOlder