Skip to content

Instantly share code, notes, and snippets.

View cybernetics's full-sized avatar

Rajkumar Singh cybernetics

  • American Airlines
  • Tempe, AZ 85281, USA
  • 02:07 (UTC -07:00)
  • X @quanta007
View GitHub Profile
@odytrice
odytrice / README.md
Last active March 24, 2023 07:24
Kubectx, Kubens for Windows (Powershell)

How to get @DevBlackOps Terminal-Icons module working in PowerShell on Windows

Note: since version 0.1.1 of the module this now works in Windows PowerShell or PowerShell Core.

  1. Download and install this version of Literation Mono Nerd Font which has been specifically fixed to be recognised as monospace on Windows:

https://github.com/haasosaurus/nerd-fonts/blob/regen-mono-font-fix/patched-fonts/LiberationMono/complete/Literation%20Mono%20Nerd%20Font%20Complete%20Mono%20Windows%20Compatible.ttf

(see this issue for more info: ryanoasis/nerd-fonts#269)

@sockeqwe
sockeqwe / AdapterDelegateDslExample.kt
Created July 22, 2019 08:19
AdapterDelegates Kotlin DSL
/**
* Let's say we want to display a list of Animals in a RecyclerView.
* The list can contain items of type Dog, Cat and Snake.
*/
// AdapterDelegate for Dog.
fun dogAdapterDelegate(picasso : Picasso) = adapterDelegate<Dog, Animal>(R.layout.item_dog){ // Generics Types means this AdapterDelegate is used if item is instanceof Dog (whole list is List<Anmial>)
// this block is run once in onCreateViewHolder. Think of it as an intializer for a ViewHolder.
val name = findViewById(R.id.name)
val image = findViewById(R.id.image)
@swyxio
swyxio / cloudos.md
Last active May 3, 2023 12:23
Cloud Operating Systems and Reconstituting the Monolith. tweet responses: https://twitter.com/swyx/status/1226257539886669825?s=20
@alexellis
alexellis / README.md
Last active February 8, 2021 20:50
Provision faasd 0.7.5 on DigitalOcean with Terraform 0.12.0
  1. Sign up to DigitalOcean
  2. Download Terraform
  3. Clone this gist using the URL from the address bar
  4. Run terraform init
  5. Run terraform apply -var="do_token=$(cat $HOME/digitalocean-access-token)"
  6. View the output for the login command and gateway URL i.e.
gateway_url = http://178.128.39.201:8080/
login_cmd = faas-cli login -g http://178.128.39.201:8080/ -p rvIU49CEcFcHmqxj
@raulraja
raulraja / TwitterHandle.kt
Created February 20, 2020 12:16
Type Refinements with Type Proofs in Kotlin
/* Coming up ~ April 2020 */
package test
import arrow.*
inline class TwitterHandle(val handle: String) {
companion object : Refined<String> {
override val validate: String.() -> Map<String, Boolean> = {
mapOf(
"Should start with '@'" to startsWith("@"),
[
// default usefull:
// CTRL+J => bottom panel
// CTRL+S => can be used to pin a tab
// CTRL+MAJ+; => open breadcrumbs
// CTRL+D => add next occurence of current selection to selection
// ALT+C => navigate to next error
// SHIFT+F5 => stop debugging
// CTRL+ALT+(up/down) => multi select
// CTRL+R => switch workspaces
!j::Send ^{Left}
!l::Send ^{Right}
!i::Send {Up}
!k::Send {Down}
!u::Send {Left}
!o::Send {Right}
!m::Send {End}
!ù::Send {Home}
function! LoadTerminal()
let bnr = bufnr('!/bin/bash')
if bnr > 0
:sbuffer !/bin/bash
else
:term
endif
endfunction
/** Crazy 1 */
import java.util.ArrayList;
public class Crazy1 {
// Props to:
// - https://stackoverflow.com/questions/15496/hidden-features-of-java
// - Java Puzzlers (Joshua Bloch)