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 / jwt.go
Created October 13, 2022 23:07 — forked from goodylili/jwt.go
JWT tutorial in Go using the golang-jwt package
package main
import (
"encoding/json"
"fmt"
"github.com/golang-jwt/jwt"
"log"
"net/http"
"time"
)
@ilmsg
ilmsg / slideshare-downloader.sh
Created July 3, 2022 08:50 — forked from giudinvx/slideshare-downloader.sh
Slideshare Downloader
#!/bin/bash
#-----------------------------------------------
# Modify 4/08/2018 by giudinvx
# Email giudinvx[at]gmail[dot]com
#-----------------------------------------------
# Author: Andrea Lazzarotto
# http://andrealazzarotto.com
# [email protected]
@ilmsg
ilmsg / sort.ex
Created July 2, 2022 01:02 — forked from rylev/sort.ex
Sort Algorithms in Elixir
## Sort Algorithms in Elixir
# Selection Sort
defmodule Selection do
def sort(list) when is_list(list) do
do_selection(list, [])
end
def do_selection([head|[]], acc) do
@ilmsg
ilmsg / big-o.md
Created July 1, 2022 22:54 — forked from PJUllrich/big-o.md
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements
@ilmsg
ilmsg / request_helper.ex
Created June 28, 2022 07:54 — forked from bluzky/request_helper.ex
Elixir download/stream large file with hackney
defmodule RequestHelper do
@moduledoc """
Reference from https://gist.github.com/avdi/7990684
Stream download large file from url
"""
require Logger
@doc """
Get stream data from url
mode could be `:binary` or `:line`
@ilmsg
ilmsg / gist:d80d5d503cac9c369b63bb2ba28d8c91
Created June 28, 2022 07:54 — forked from avdi/gist:7990684
Streaming a URL to a file in Elixir
def download_video(Episode[filename: filename] = episode) do
Stream.resource(fn -> begin_download(episode) end,
&continue_download/1,
&finish_download/1)
|> File.stream_to!(filename)
|> Stream.run
end
def begin_download(Episode[video_url: video_url,
account: Account[login: login,
@ilmsg
ilmsg / my_app.ex
Created June 25, 2022 18:02 — forked from alanpeabody/my_app.ex
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@ilmsg
ilmsg / counter.exs
Created June 13, 2022 21:23 — forked from killme2008/counter.exs
Elixir gen server example
defmodule Counter do
use GenServer
def start_link(init_value \\ 0, opts \\ []) do
GenServer.start_link(__MODULE__, init_value, opts)
end
## client apis
def get(c) do
GenServer.call(c, {:get})
end
@ilmsg
ilmsg / main.rs
Created April 2, 2022 00:23 — forked from rajeshpachaikani/main.rs
Face and Eye detection using Opencv On Rustlang
use opencv::{
Result,
prelude::*,
objdetect,
highgui,
imgproc,
core,
types,
videoio,
};
@ilmsg
ilmsg / .gitlab-ci.yml
Created August 13, 2021 09:20 — forked from smrfeld/.gitlab-ci.yml
GitLab CI for firebase functions
image: node:12.13.0-alpine
before_script:
- npm i -g firebase-tools
test-functions:
stage: test
script:
- cd functions
- npm install