Skip to content

Instantly share code, notes, and snippets.

View pawiromitchel's full-sized avatar
🔥
By doing nothing, you become nothing

Mitchel pawiromitchel

🔥
By doing nothing, you become nothing
View GitHub Profile
@pawiromitchel
pawiromitchel / urlExists.js
Created January 27, 2017 11:27
JS - check if an object or url exists
function urlExists(testUrl) {
var http = $.ajax({
type:"HEAD",
url: testUrl,
async: false
})
return http.status;
// this will return 200 on success, and 0 or negative value on error
}
@pawiromitchel
pawiromitchel / random.php
Last active February 2, 2017 15:52
PHP - Random string generator
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
@pawiromitchel
pawiromitchel / search_in_object.js
Created February 9, 2017 11:40
JS - search-in-object-values
var a = [{
name: 'xyz',
grade: 'x'
}, {
name: 'yaya',
grade: 'x'
}, {
name: 'x',
frade: 'd'
}, {
@pawiromitchel
pawiromitchel / tmux-cheatsheet.markdown
Created July 18, 2017 12:32 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@pawiromitchel
pawiromitchel / resetJsonArray.js
Created January 31, 2018 18:18
Reset JSON Array dynamically
resetJsonArray(json){
let temp = [];
for (var i in json) {
var key = i;
var val = json[i];
for (var j in val) {
var sub_key = j;
var sub_val = val[j];
temp.push(sub_key);
}
@pawiromitchel
pawiromitchel / find.sh
Created April 11, 2018 15:35
Find encoded PHP code
find /home/ -type f -exec grep -H '@include "' {} \;
@pawiromitchel
pawiromitchel / install_docker_kali.sh
Last active July 18, 2019 16:24 — forked from nikallass/Kali 2017.1 x64, Docker-ce Install script
Kali 2018, Docker-ce Install script
#!/bin/bash
# update apt-get
export DEBIAN_FRONTEND="noninteractive"
sudo apt-get update
# remove previously installed Docker
sudo apt-get remove docker docker-engine docker.io* lxc-docker*
# install dependencies 4 cert
@pawiromitchel
pawiromitchel / index.js
Created April 20, 2018 03:04 — forked from JonathanMH/index.js
JSON Web Token Tutorial: Express
// file: index.js
var _ = require("lodash");
var express = require("express");
var bodyParser = require("body-parser");
var jwt = require('jsonwebtoken');
var passport = require("passport");
var passportJWT = require("passport-jwt");
@pawiromitchel
pawiromitchel / bcrypt.java
Created May 9, 2018 23:19
Java bcrypt example
import org.mindrot.jbcrypt.BCrypt;
public class App {
public static void main(String[] args) {
String inputpassword = "mitchel1";
String storedpassword = "mitchel";
String hashedStoredPassword = BCrypt.hashpw(storedpassword, BCrypt.gensalt());
@pawiromitchel
pawiromitchel / PasswordValidateTest.java
Last active May 11, 2018 23:56
Test a password on specific options
import org.junit.Assert;
import org.junit.Test;
import java.util.regex.Pattern;
public class PasswordValidator {
// dummy password
public String passwordString = "M!@jat91";
// split the password into individual chars to loop through next