Skip to content

Instantly share code, notes, and snippets.

r := gin.New()
// CORS
r.Use(middlewares.Cors())
r.Use(ginrus.Ginrus(loggers.LoggerImpl, time.RFC3339, true))
// Recovery middleware
r.Use(gin.Recovery())
/* --------------------------- Public routes --------------------------- */
@gie3d
gie3d / nextjs-deploy.md
Created August 5, 2023 04:32 — forked from jjcodes78/nextjs-deploy.md
Deploying NEXTJS site with nginx + pm2

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

@gie3d
gie3d / main.dart
Created December 2, 2022 12:24
bold-kingdom-9328
void main() {
x();
}
void x() {
final stream = Stream.periodic(const Duration(seconds: 1), (i) => i * i)
.take(5);
final subscription = stream.listen((x) {
print(x);
void main() {
x();
}
void x() {
final stream = Stream.periodic(const Duration(seconds: 1), (i) => i * i)
.take(5);
final subscription = stream.listen((x) {
print(x);
const fs = require('fs');
fs.readFile('input', 'utf8', (err, contents) => {
// console.log(contents);
const data = parseData(contents);
data.prices.sort((a, b) => a > b);
const result = solve(data.prices, data.m);
console.log(result);
});
@gie3d
gie3d / field.js
Last active March 26, 2020 02:06
const fs = require('fs');
fs.readFile('input', 'utf8', (err, contents) => {
console.log(contents);
const data = parseData(contents);
// console.log(data);
const result = findBestRoutePoint(data);
console.log(result);
});
@gie3d
gie3d / unity-long-press.cs
Created March 3, 2020 10:01
Unity Long Press script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using System;
public class LongPress : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler
{
[Tooltip("Time before the long press triggered")]
@gie3d
gie3d / index.js
Created June 18, 2017 17:08
Sample LINE Bot SDK node.js with more text events
const express = require('express');
const line = require('@line/bot-sdk');
require('dotenv').config();
const app = express();
const config = {
channelAccessToken: process.env.channelAccessToken,
channelSecret: process.env.channelSecret
@gie3d
gie3d / event.json
Last active June 18, 2017 16:39
Sample LINE event object
{
"events": [
{
"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
"type": "message",
"timestamp": 1462629479859,
"source": {
"type": "user",
"userId": "U206d25c2ea6bd87c17655609a1c37cb8"
},
@gie3d
gie3d / index.js
Created June 18, 2017 16:30
Sample LINE Bot using node.js express
const express = require('express');
const line = require('@line/bot-sdk');
require('dotenv').config();
const app = express();
const config = {
channelAccessToken: process.env.channelAccessToken,
channelSecret: process.env.channelSecret