Skip to content

Instantly share code, notes, and snippets.

View cherryramatisdev's full-sized avatar
🏠
Working from home

Cherry Ramatis cherryramatisdev

🏠
Working from home
View GitHub Profile
#!/bin/bash
LOGFILE="$HOME/projects/dotfiles/work_track_time"
#disables the error if the directory exists, creates parent directories if needed
mkdir -p $(dirname $LOGFILE)
_format_task () {
# The assignment asks us to convert the time to HH:MM:SS, but also to make sure it runs correctly if the task exeeceds 24H.
# I choose to optionally render the time as D:HH:MM:SS if the time exceedes 24H.
local T=$1
#!/usr/bin/env python3
import json
with open("./target.json", "r") as file:
target_file = json.load(file)
for t in target_file["SearchWord"]:
prefix = {"create": {"_index": "searchword", "_type": "_doc"}}
words = {
"word": t["SearchWord"],
@cherryramatisdev
cherryramatisdev / index.html
Created August 23, 2022 18:19
Small iframe loader
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<style>
body {
margin: 0;
background: black;
@cherryramatisdev
cherryramatisdev / default.module.ts
Created November 30, 2022 16:13
How to setup mongoDB using typeorm on nestjs
import { Module, NestModule } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
@Module({
imports: [
TypeOrmModule.forRoot({
...{
type: 'mongodb',
url: '<your-mongo-db-atlas-url-here>',
synchronize: false,
@cherryramatisdev
cherryramatisdev / .vimrc
Created March 19, 2023 20:18
My config of COC vim
" ________________ COC.NVIM ________
let g:coc_global_extensions = ['coc-json',
\ 'coc-git',
\ 'coc-snippets',
\ 'coc-tsserver',
\ 'coc-eslint',
\ 'coc-rust-analyzer',
\ 'coc-cssmodules',
\ 'coc-marketplace',
\ 'coc-java',

how to build crystal for multiple OS

on:
  push:
  pull_request:
    branches: [main]
jobs:
  build:
 strategy:
#!/bin/sh
pushd "$(git rev-parse --show-toplevel)" &>/dev/null
get_package_manager() {
if [[ -f "yarn.lock" ]]; then
echo "yarn"
elif [[ -f "package-lock.json" ]]; then
echo "npm"
elif [[ -f "pnpm-lock.yaml" ]]; then
@cherryramatisdev
cherryramatisdev / gist:efa7e0bd74325be11b24c0d42f44771e
Last active July 7, 2023 20:21
A lot of data to postgres database with golang
package main
import (
"database/sql"
"encoding/json"
"fmt"
"io/ioutil"
"os"
_ "github.com/lib/pq"
local function getLastDirectory(fullPath)
-- Replace "file:////" with an empty string to remove it from the path
local cleanPath = string.gsub(fullPath, "file:////", "")
-- Separate the path using the directory separator "/"
local directories = {}
for directory in string.gmatch(cleanPath, "[^/]+") do
table.insert(directories, directory)
end
use std::error::Error;
use actix_web::{get, App, HttpResponse, HttpServer};
use leptos::*;
const PORT: u16 = 4000;
#[get("/")]
async fn hello() -> Result<HttpResponse, Box<dyn Error>> {
let html = leptos::ssr::render_to_string(move |ctx| {