Skip to content

Instantly share code, notes, and snippets.

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

Ra rainrisa

🏠
Working from home
  • Japan
View GitHub Profile
@rainrisa
rainrisa / main.rs
Created August 2, 2022 23:53
My first rust program
#[derive(Debug)]
struct TelegramUser {
id: u32,
name: String
}
trait User {
fn new (name: String, id: u32) -> Self;
@rainrisa
rainrisa / nvim-arch.md
Created August 6, 2022 01:38
Run Nvim inside Arch Linux
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": true,
"outDir": "./lib",
"strict": true
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*"]
@rainrisa
rainrisa / note.md
Created August 12, 2022 21:47 — forked from uWynell/note.md
Telegraf parallel handling

Introduction

Telegraf handles all requests sequentially, one after another. I won't get into details about why it might be done like that by default, but sometimes it's not really what you want.

So I had this problem too. While the bot was handling one heavy command, it could not handle other commands at the same time. Even if they were in different chats. That was quite a problem for me.

I didn't dive inside Telegraf, instead I just came up with a guess and it worked. I'm just sharing my experience, you might need to tweak the code for yourself a little.

Solutions

@rainrisa
rainrisa / gramlify.md
Created August 14, 2022 23:07
First Gramlify
// src/index.ts

import { Gramlify } from "./types/index.js";

function Gramlify(this: Gramlify, telegramApi: string) {
  this.yeah = "yeah";
}

export default Gramlify;
@rainrisa
rainrisa / index.js
Created August 23, 2022 22:28
learn sequelize
import { Sequelize, DataTypes } from "sequelize";
const sequelize = new Sequelize("rainjn", "root", "", {
host: "localhost",
dialect: "mysql",
define: {
timestamps: false,
},
});
const queryInterface = sequelize.getQueryInterface();
@rainrisa
rainrisa / index.txt
Created October 22, 2022 01:36
running docker on arch wsl
WARN[2022-10-22T08:25:01.363088467+07:00] grpc: addrConn.createTransport failed to connect to {unix:///var/run/docker/containerd/containerd.sock <nil> 0 <nil>}. Err :connection error: desc = "transport: error while dialing: dial unix:///var/run/docker/containerd/containerd.sock: timeout". Reconnecting... module=grpc
1. Kill dockerd process
ps -aux | grep dockerd
kill -9 [dockerd process_id]
2. Start dockerd process
sudo dockerd
3. Move the process in the background
@rainrisa
rainrisa / vim_cheatsheet.md
Created October 23, 2022 17:11 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@rainrisa
rainrisa / install.sh
Created October 25, 2022 16:56
nvim web devicons
#/bin/bash
# install DroidSansMono Nerd Font --> u can choose another at: https://www.nerdfonts.com/font-downloads
# run ./install.sh
# if permission denied, read this: https://askubuntu.com/a/38670
echo "[-] Download fonts [-]"
echo "https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/DroidSansMono.zip"
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/DroidSansMono.zip
unzip DroidSansMono.zip -d ~/.fonts
fc-cache -fv
echo "done!"