Skip to content

Instantly share code, notes, and snippets.

View AmaranthLIS's full-sized avatar

Igor Lu AmaranthLIS

View GitHub Profile
@AmaranthLIS
AmaranthLIS / restart-ssh
Created October 18, 2021 13:47 — forked from influx6/restart-ssh.bash
Restart SSH on Mac Terminal (High Sierra)
sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd
@AmaranthLIS
AmaranthLIS / git-pushing-multiple.rst
Created December 1, 2020 20:37 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@AmaranthLIS
AmaranthLIS / micronaut-file-upload.java
Created November 28, 2020 09:51
micronaut file upload
package example.micronaut;
//tag::imports[]
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Consumes;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Post;
import io.micronaut.http.multipart.CompletedFileUpload;
@AmaranthLIS
AmaranthLIS / ContactPhonesTest.kt
Created November 19, 2020 22:07 — forked from mustafo/ContactPhonesTest.kt
The right way to use one to many relationship in jdbi with kotlin
import org.jdbi.v3.core.kotlin.KotlinMapper
import org.jdbi.v3.core.mapper.RowMapperFactory
import org.junit.jupiter.api.Test
import tj.alif.core.app.db.RepositoryTest
import org.jdbi.v3.core.result.RowView
data class Contact (
val id: Int,
val name: String,
@AmaranthLIS
AmaranthLIS / CheckPyramid.java
Created December 23, 2018 11:24
Calculate pressure on select row/position in Pyramid
import java.math.BigDecimal;
import java.math.RoundingMode;
public class Main {
public static void main(String... args) {
int row = 322, position = 156;
PyramidPressure pyramidPressure = new PyramidPressure();
BigDecimal value = pyramidPressure.getPressure(row, position);
System.out.println("Result = " + value);
@AmaranthLIS
AmaranthLIS / tmux_cheatsheet.markdown
Created December 17, 2018 13:06
Tmux cheatsheet

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@AmaranthLIS
AmaranthLIS / ConnectToOpenId
Created October 19, 2018 23:49
Golang, OpenID Connect auth code flow with Go
package main
import (
"crypto/rand"
"encoding/binary"
"fmt"
"github.com/coreos/go-oidc"
"golang.org/x/oauth2"
)
@AmaranthLIS
AmaranthLIS / Kuber env-tool
Created October 19, 2018 23:48
Golang, Read and write Kubernetes client config (~/.kube/config)
package main
import (
"log"
"os"
"github.com/mitchellh/go-homedir"
"k8s.io/client-go/tools/clientcmd"
)
@AmaranthLIS
AmaranthLIS / HTTP-server with Shutdown
Created October 19, 2018 23:46
Golang: Shutdown HTTP server by requesting specific URL
package main
import (
"context"
"fmt"
"log"
"net/http"
)
func main() {
package main
import (
"io/ioutil"
"log"
"net/http"
"crypto/tls"
"crypto/x509"
)