Skip to content

Instantly share code, notes, and snippets.

View mezerotm's full-sized avatar
🪙
0x4EEB2D6Ec9cd842a13ab24c013b7a7A66F6AC2B4

Carlos Rincon mezerotm

🪙
0x4EEB2D6Ec9cd842a13ab24c013b7a7A66F6AC2B4
View GitHub Profile
@mezerotm
mezerotm / recursivelyApplyRoutes.js
Created June 29, 2017 20:03
Recursively applies routes to restify using [restify-router](https://www.npmjs.com/package/restify-router). Create folders and place index.js at each level. for example `/routes/users/index.js` will appear as `localhost:3000/users/`
function recursivelyApplyRoutes(route){
(function recurse(dir){
let absoluteRoutesPath = process.cwd() + route + (dir? dir:'');
fs.readdirSync(absoluteRoutesPath).forEach((file) =>{
let absoluteCurrentFilePath = absoluteRoutesPath + '/' + file;
let isDirectory = fs.statSync(absoluteCurrentFilePath).isDirectory();
if(isDirectory) recurse((dir? dir:'') + '/' + file);
if(file.indexOf('index.js') !== -1) require(absoluteCurrentFilePath).applyRoutes(server, dir);
@mezerotm
mezerotm / .bashrc
Created October 3, 2017 11:50
Does a basic linux network scan.
function network() {
ip_address="$(ip route get 8.8.8.8 | tr -s ' ' | cut -d' ' -f7)"
echo "$(ip -c -br address)"
echo
echo "$(ip -c -br link)"
echo
echo "$(route)"
echo
echo "$(nmap $ip_address)"
while sleep 1; do
tput sc; tput cup 0 $(($(tput cols)-29)); date; tput rc;
done
@mezerotm
mezerotm / Database.java
Created March 2, 2018 06:00
JavaFX database and table view classes.
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
@mezerotm
mezerotm / forLoop.js
Created May 19, 2018 23:13
Modern javascript 'for of' loop
for (let [innerKey, innerValue] of Object.entries(value)) {
}
@mezerotm
mezerotm / .eslintrc.js
Created July 6, 2018 21:21
webpack 3 setup with javascript standard style
module.exports = {
extends: [
'standard'
],
}
@mezerotm
mezerotm / .gitmessage
Created March 23, 2019 09:30
A git template message taking into account agreed upon practices by the community. Hopefully git messages one day will be standardized..
# <type>: (If applied, this commit will...) <keyword> <subject> (5o char. max)
# Explain why this change is being made (72 char. max)
# --- TYPE
# feat (new feature)
# fix (bug fix)
# refactor (refactoring production code)
# style (formatting, missing semi colons, etc; no code change)
# docs (changes to documentation)
@mezerotm
mezerotm / main.js
Last active June 4, 2019 08:42
This is instructions on how to get sqlite to work with ionic. an alternative to `@ionic/storage` - This can also work with normal Vue, just don't install cordova stuff. Installing: `ionic cordova plugin add cordova-sqlite-storage` & `npm i localforage localforage-cordovasqlitedriver` Thanks to [vue-localforage](https://github.com/dmlzj/vlf) for …
import { localForage, VueLocalForage } from './plugins/vue-localforage'
Vue.use(VueLocalForage)
// to check for proper installation - can be deleted afterwords
localForage.ready().then(() => {
console.log(localForage.driver())
})
new Vue({
@mezerotm
mezerotm / crontab
Created December 20, 2019 07:32
The `tmp` script belongs in the `reboot` folder and is used to delete temporary files, Set browsers and other programs to automatically place files in the tmp folder to not manage manual deletion
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
@mezerotm
mezerotm / Documents
Created December 20, 2019 07:40
This is the way I organize my system file strucure. For the most part, some folders go very deep but are not included.
This file has been truncated, but you can view the full file.
.
├── personal
│   ├── finance
│   │   ├── budget
│   │   │   ├── allocated_spending
│   │   │   ├── breakdown_of_saving
│   │   │   ├── consumer_equity_sheet
│   │   │   ├── debt_snowball
│   │   │   ├── income_sources
│   │   │   ├── lump_sum_payment