Skip to content

Instantly share code, notes, and snippets.

View ilmsg's full-sized avatar
😍
love me love my bug

Eak Netpanya ilmsg

😍
love me love my bug
View GitHub Profile
@ilmsg
ilmsg / java-stream-readme.md
Created March 13, 2024 10:46 — forked from etexier/java-stream-readme.md
Cheat sheet on Java streams

Java Streams

Overview

As part of Java 8 new features, lambda expressions are now supported (Project Lambda). See this very easy-to-read article from Brian Goetz State of the Lambda but more importantly focusing more on streams: State of the Lambda: Libraries Edition

Quick ways to create a stream

// From parameters
Below is a simple exmple of how to use gitlab ci
you need to have two different runner: one windows with tag "windows" and one linux with tag "linux"
the pipeline basically try to do
-some go static check
-build go app on both window and linux parallel
-run int test
-deploy goapp to qa1 and qa2 parallel
-deploy to production
there is a lot room to improve this, say, qa1 could be a windows qa2 could be a linux, say, we do not really need runner but can use
@ilmsg
ilmsg / docker-compose.yml
Created November 21, 2023 13:45 — forked from benoitpetit/docker-compose.yml
complete Gitlab installation and a runner with docker
version: '4.5'
services:
# GITLAB
gitlab-web:
image: 'gitlab/gitlab-ce:latest'
restart: always
container_name: gitlab-web
hostname: '192.168.0.14'
environment:
@ilmsg
ilmsg / main.go
Created November 5, 2023 05:03 — forked from Ice3man543/main.go
Golang MongoDB connection example
package main
import (
"context"
"time"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/mongo/readpref"
)
package main
import (
"fmt"
"math/rand"
"time"
"flag"
)
const (
int motorPin1 = 8;// Blue - 28BYJ48 pin 1
int motorPin2 = 9;// Pink - 28BYJ48 pin 2
int motorPin3 = 10;// Yellow - 28BYJ48 pin 3
int motorPin4 = 11;// Orange - 28BYJ48 pin 4
int motorSpeed = 4; //variable to set stepper speed
char val = '0';
void setup() {
//declare the motor pins as outputs
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
@ilmsg
ilmsg / modal_llama2.py
Created July 19, 2023 18:29 — forked from stevenhao/modal_llama2.py
modal script that creates llama2_image and defines a function that can run inference on it
from modal import Image, Stub, Secret, gpu
from pathlib import Path
import os
MODEL_PATH = "/model"
def download_models():
from transformers import AutoTokenizer, AutoModelForCausalLM
token = os.environ["HUGGINGFACE_TOKEN"]
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf", use_auth_token=token)
@ilmsg
ilmsg / chickenVsEgg.js
Created July 19, 2023 12:30 — forked from jiristepan/chickenVsEgg.js
Chicken egg problem solved by javascript
let question = ['🥚','🐔']
let answer = question.sort()
console.log(answer[0] + ' was first!')
@ilmsg
ilmsg / line_bot_elixir_howto_en.md
Created June 10, 2023 18:02 — forked from adamu/line_bot_elixir_howto_en.md
How to make a Line Chatbot with Elixir

This is my entry for the fukuoka.ex Elixir/Phoenix Advent Calendar 2019 day 13, and it's a guide for how to write a Line bot using Elixir. 🧪🤖🧪

日本語版はこちらです。

  1. First you need to create a Messaging API Channel on the Line Developers Console. You will also need to add your bot as a friend, and know the generated Channel ID and Channel Secret.

  2. Create a new Elixir app with a supervision tree:

    mix new advent --sup

  3. cd advent

  4. If you want to use git, now we can create a repository (optional):

@ilmsg
ilmsg / submit.md
Created May 5, 2023 10:55 — forked from tanaikech/submit.md
Resumable Uploading Files to Google Drive using Golang

Resumable Uploading Files to Google Drive using Golang

This is a sample script for the resumable upload of Files to Google Drive using Golang. This script uses the library of google-api-go-client. About the installation of google-api-go-client, please check the Quickstart for golang at the official site.

Sample script:

package main

import (