Skip to content

Instantly share code, notes, and snippets.

View bilashcse's full-sized avatar
👨‍💻
Coding is fun

Nazmul Hossain bilashcse

👨‍💻
Coding is fun
View GitHub Profile
@agodin3z
agodin3z / sequelize-migration-file-generator.js
Last active June 16, 2023 08:13 — forked from manuelbieh/sequelize-migration-file-generator.js
Creates migration files for existing sequelize models [custom]
#!/usr/bin/env node
const fs = require('fs');
const models = require('../models');
for (const model in models) {
const tableName = models[model].tableName;
let defaultValue = '';
let onUpdate = '';
@silver-xu
silver-xu / ts-boilerplate.md
Last active June 19, 2024 15:10
Setup a Node.js project with Typescript, ESLint, Prettier, Husky

Setup a Node.js project with Typescript, ESLint, Prettier, Husky

1_D8Wwwce8wS3auLAiM3BQKA

Starting a personal node project could be easy; starting a team node project could be challenging.

I am a developer currently working in SEEK Australia.

In my experience, common mistakes developer make when starting a projects are:

  • No Linting
@manashmandal
manashmandal / egghead_downloader.py
Last active May 27, 2019 20:51
Egghead Course Download Script
from lxml import html
import requests
import os
import json
from tqdm import tqdm
COURSES = """https://egghead.io/courses/cycle-js-fundamentals
https://egghead.io/courses/use-d3-v3-to-build-interactive-charts-with-javascript
@mugli
mugli / findLongRunningOp.js
Created December 3, 2018 06:08 — forked from kylemclaren/findLongRunningOp.js
Find and (safely) kill long running MongoDB ops
db.currentOp().inprog.forEach(
function(op) {
if(op.secs_running > 5) printjson(op);
}
)
@mugli
mugli / query_finder.sql
Last active February 10, 2019 05:52 — forked from mezis/query_finder.sql
Finding long-running queries in MySQL
SELECT id, concat('kill ', id, ';') as kill_command, state, command, time, info
FROM information_schema.processlist
WHERE command <> 'Sleep'
AND info NOT LIKE '%PROCESSLIST%'
ORDER BY time DESC LIMIT 50;
@AminulBD
AminulBD / bd-geo-code.sql
Last active April 2, 2023 22:19
BD GEO Code SQL Database
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
SET NAMES utf8mb4;
DROP TABLE IF EXISTS `districts`;
CREATE TABLE `districts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@chj1768
chj1768 / simple_rsa
Last active December 16, 2022 07:20
RSA encryption / decryption example (nodejs)
openssl key pair generate
//client - using meteor.js
const nodersa = Npm.require('node-rsa');
import { HTTP } from 'meteor/http';
const syncPost = Meteor.wrapAsync( HTTP.post, HTTP );
encryptStringWithRsaPublicKey( data ) {
const absolutePath = Assets.absoluteFilePath( "public.key" ); //public key file path
const publicKey = fs.readFileSync( absolutePath, "utf8" );
@joseluisq
joseluisq / terminal-git-branch-name.md
Last active June 14, 2024 19:05
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@linhmtran168
linhmtran168 / pre-commit-eslint
Last active June 20, 2024 23:01
Pre-commit hook to check for Javascript using ESLint
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
@peterdemartini
peterdemartini / jshintrc.txt
Last active June 12, 2019 20:08
My .jshintrc for Node.js and clean JavaScript
{
"passfail": false, // Stop on first error
"maxerr": 100, // Maximum error before stopping
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
"browser": true, // Standard browser globals e.g. `window`, `document`.
"esnext": true, // Allow ES.next specific features such as `const` and `let`.
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
"camelcase": false, // Permit only camelcase for `var` and `object indexes`.
"curly": false, // Require {} for every new block or scope.
"eqeqeq": true, // Require triple equals i.e. `===`.