Skip to content

Instantly share code, notes, and snippets.

View xdevmaycry's full-sized avatar
🎯
Focusing

devmaycry xdevmaycry

🎯
Focusing
View GitHub Profile
@xdevmaycry
xdevmaycry / interface.md
Last active November 9, 2023 12:00
typescripts.md
  1. Define interface for nested object, with [key: string]

    export interface Item {
      id: number;
      size: number;
     }
    
    export interface Example {

name: string;

@xdevmaycry
xdevmaycry / createProvider.js
Created May 5, 2020 07:16 — forked from ArcanisCz/createProvider.js
React Error Boundary, which can catch Component + Redux + Saga errors
/*
* Usage:
* const AppProvider = createProvider(rootReducer, rootSaga);
* ...
* <AppProvider>
* <AppComponent>
* </AppProvider>
*/
const createProvider = (reducer, saga) => {
const sagaMiddleware = createSagaMiddleware();
@xdevmaycry
xdevmaycry / .bashrc
Created March 13, 2020 18:13
.bashrc
# pull all git repo
alias git-pull-all="find . -maxdepth 3 -name .git -type d | rev | cut -c 6- | rev | xargs -I {} git -C {} pull"
@xdevmaycry
xdevmaycry / main.md
Last active May 3, 2023 02:00
Setup repo deploy key to allow private NPM Package hosted on Github.com be read by CircleCI

Setup repo deploy key to allow private NPM Package hosted on Github.com be read by CircleCI

Takes about 2 minutes

1. Add the private package to your project and test the git link

GitHub, private repo:

@xdevmaycry
xdevmaycry / .bash_profile
Last active May 24, 2019 05:22
WSL aka Windows Subsystem for Linux
## To make sure ~/.bashrc gets autoladed when launching WSL
if [[ -f ~/.bashrc ]] ; then
. ~/.bashrc
fi
## To make sure ~/.zshrc gets autoladed when launching WSL
if [[ -f ~/.zshrc ]] ; then
. ~/.zshrc
fi
@xdevmaycry
xdevmaycry / nginx.conf
Created February 22, 2019 06:24 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@xdevmaycry
xdevmaycry / crontab.md
Last active November 2, 2018 05:50
certbot

install cron job at root

sudo crontab -e

renew every day at 10:59pm

59 22 * * * /usr/bin/certbot renew > /home/ubuntu/logs/certbot.log
@xdevmaycry
xdevmaycry / mysql-docker.sh
Last active November 1, 2018 20:57 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
###############
# MODIFIED FOR SECURITY
#
# This assumes we have the following environmental variables setup through docker composer configuration
# MYSQL_DB
# MYSQL_USER
# MYSQL_PASSWORD
###############
# Backup
#!/bin/bash
#
# /etc/rc.d/init.d/script_name
# script_name This shell script takes care of starting and stopping
# script_name (the Fedora Directory Server)
#
# Author: Brian Jones
# This e-mail address is being protected from spambots. You need JavaScript enabled to view it
# Taken from: https://www.linux.com/learn/managing-linux-daemons-init-scripts
#
@xdevmaycry
xdevmaycry / get_file_last_modified_date.js
Last active February 1, 2018 02:05
Get Last Modified Date from a Public Accessible File (Async). No external libraries required. ECMAScript 5.
/*
*
* Fiddle: https://jsfiddle.net/w79L4wan/10/
*/
function ready(callback) {
// in case the document is already rendered
if (document.readyState!='loading') callback();
// modern browsers
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', callback);