Skip to content

Instantly share code, notes, and snippets.

View levlaz's full-sized avatar

Lev Lazinskiy levlaz

View GitHub Profile
@levlaz
levlaz / test.py
Last active October 8, 2024 17:57
Testing wtih dagger/dagger
@function
async def text_examples(self, source: dagger.Directory) -> str:
output = ""
for language in ["python", "typescript", "go", "shell"]:
output += await (
dag.
dagger_dev().
dev().
with_mounted_directory("/src", source).
with_workdir("/src").
@levlaz
levlaz / main.go
Created January 9, 2024 15:13
Direct Call
package main
import (
"log"
"os"
"os/exec"
)
func main() {
cmd := exec.Command("dagger", "call", "-m", "github.com/shykes/daggerverse/hello", "message")
@levlaz
levlaz / main.go
Created October 10, 2023 14:54
Dagger + Hugo
package main
import (
"context"
"fmt"
"os"
"path/filepath"
"dagger.io/dagger"
)
```
Caught panic:
runtime error: slice bounds out of range [7:5]
Restoring terminal...
goroutine 1 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
@levlaz
levlaz / app.js
Last active May 26, 2021 01:25
React Hook Demo with Form Handling
import { Route, Switch } from 'react-router-dom';
import HooksDemo from './hooksDemo';
import React from 'react';
import { withLDProvider } from 'launchdarkly-react-client-sdk';
const App = () => (
<div>
<main>
<Switch>
@levlaz
levlaz / conf.yml
Last active August 3, 2021 02:41
Nonsense logs with PII
logs:
- type: file
path: "tmp/sample_logger.log"
service: "nf"
@levlaz
levlaz / main.java
Created July 24, 2019 23:52
Java Relay Snippet
import com.launchdarkly.client.LDClient;
import com.launchdarkly.client.LDConfig;
import com.launchdarkly.client.LDUser;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import static java.util.Collections.singletonList;
@levlaz
levlaz / ubuntu.md
Last active July 11, 2019 02:51
Ubuntu Init Notes

Add New User

adduser $USERNAME

Make vim default editor

sudo update-alternatives --config editor
@levlaz
levlaz / vscode.md
Created July 2, 2019 02:36
VS Code Config Notes

Add vertical ruler

This is helpful to see when you are about to go over 80 characters.

In settings.json

{
    "editor.rulers": [80]
}
@levlaz
levlaz / git.md
Created July 2, 2019 02:35
Git Cheat Sheet

Force SSH for Git Checkout

This comes up when you do go get with a private repo; it wants a username/pass instead of using your key.

git config --global url.ssh://[email protected]/.insteadOf https://github.com/