Skip to content

Instantly share code, notes, and snippets.

View doraemonxxx's full-sized avatar
:octocat:
Toxic and Hypocrite

mew doraemonxxx

:octocat:
Toxic and Hypocrite
View GitHub Profile
class benchmark {
private $startTime;
private $endTime;
private $totalOps;
private $opsCompleted;
private $intervalOpsCompleted;
private $benchInterval; //how far back in seconds the bench should look to calc
private $lastBench; //time last bench was calculated
@doraemonxxx
doraemonxxx / CheckPermission.ts
Created June 30, 2022 21:01
simply check user permission - for private project
function hasRealPermission(p: string): boolean {
const permission = userPermission;
let allPermitted = false;
const cache = {};
function getCA(perm: string): CA | null {
const p = perm?.split(/:/);
if (p?.length < 2) {
return null;
}
if (p) {
@doraemonxxx
doraemonxxx / CheckPermission.js
Created June 30, 2022 21:03
simple react or vanilla js permission checking
import { USER_INFO } from '../../redux/Authenticate/reducer';
import { useSelector } from 'react-redux';
import { cloneDeep, each, omit } from 'lodash';
const APP_USER = {
jsecalias: [],
permission: [],
allPermitted: false,
cache: {},
@doraemonxxx
doraemonxxx / leaflet-google.js
Created February 22, 2024 08:06 — forked from crofty/leaflet-google.js
Leaflet plugin that enables the use of Google Map tiles - http://matchingnotes.com/using-google-map-tiles-with-leaflet
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
@doraemonxxx
doraemonxxx / gitflow-breakdown.md
Created June 11, 2024 14:17 — forked from JamesMGreene/gitflow-breakdown.md
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@doraemonxxx
doraemonxxx / ssl-cert-on-ubuntu-lightsail-for-Moodle.md
Created June 21, 2024 12:55 — forked from nanusdad/ssl-cert-on-ubuntu-lightsail-for-Moodle.md
Setting up LetsEncrypt SSL certificate for Moodle on Ubuntu

Setting up LetsEncrypt SSL certificate for Moodle on Ubuntu

  1. Install certbot

sudo apt install certbot python3-certbot-apache
  1. Enable firewall to allow Apache https and ssh

sudo ufw status
sudo ufw enable
@doraemonxxx
doraemonxxx / enterprise_token.rb
Created September 18, 2024 07:54 — forked from markasoftware/enterprise_token.rb
OpenProject Enterprise mode for free
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ it doesn't show that enterprise mode is enabled in the settings, but all ################
############ enterprise mode features, such as KanBan boards, are enabled. ################
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
@doraemonxxx
doraemonxxx / laravel-tmuxp.yaml
Created September 22, 2024 21:04 — forked from smitmartijn/laravel-tmuxp.yaml
Run a Laravel app in a tiled tmux window with a single command.
# brew install tmuxp
# tmuxp load tmuxp.yaml
session_name: laravel-app
windows:
- window_name: laravel-app
layout: tiled
panes:
- docker-compose -f docker-compose.yml up
- php artisan serve
- npm run dev
@doraemonxxx
doraemonxxx / forge.sh
Created October 2, 2024 22:08 — forked from pLavrenov/forge.sh
Laravel Forge Setup Script (July 2020) - NGINX + MySQL
# Replace!
# [!server!] (the forge server instance)
# [!sudo_password!] (random password for sudo)
# [!db_password!] (random password for database user)
# [!user.name!] (git user name)
# [!user.email!] (git user email)
# [!server_ip!] (git user email)
#
# REQUIRES:
@doraemonxxx
doraemonxxx / deployment.sh
Created October 2, 2024 22:09 — forked from thetwopct/deployment.sh
Laravel Forge Deployment Script
cd $FORGE_SITE_PATH
pwd
php artisan down || true
echo "git fetch"
git fetch origin
echo "git checkout"