Skip to content

Instantly share code, notes, and snippets.

View nim4n136's full-sized avatar
🏠
Working from home

NIM4N nim4n136

🏠
Working from home
View GitHub Profile
@nim4n136
nim4n136 / encryption_openssl.php
Last active August 3, 2018 07:11
Encryption and Decryption OpenSSL with PHP
<?php
class Encryption
{
public $config = array(
"digest_alg" => "sha512",
"private_key_bits" => 2046,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
);
@nim4n136
nim4n136 / encryption_openssl_salt.php
Last active March 11, 2024 21:17
Encryption & Decryption salt in PHP with OpenSSL
<?php
function encrypt($data, $password){
$iv = substr(sha1(mt_rand()), 0, 16);
$password = sha1($password);
$salt = sha1(mt_rand());
$saltWithPassword = hash('sha256', $password.$salt);
$encrypted = openssl_encrypt(
@nim4n136
nim4n136 / https_socket_io.js
Created August 13, 2018 13:47
use https socket io
var fs = require( 'fs' );
var app = require('express')();
var https = require('https');
var port = process.env.PORT || 3000;
var request = require('request');
var server = https.createServer({
key: fs.readFileSync('/etc/letsencrypt/live/api.merah45.id/privkey.pem'),
@nim4n136
nim4n136 / index.php
Created September 27, 2018 03:56
Error Handler php
<?php
error_reporting(0);
register_shutdown_function('ShutDown');
include 'include.php';
function catchError($errno, $errstr, $errfile = '', $errline = ''){
echo "Eroor Type : " .$errno. "<br>";
echo "Eroor Message : " . $errstr . "<br>";
@nim4n136
nim4n136 / async-await.js
Created November 27, 2018 16:07 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@nim4n136
nim4n136 / Sync gh-pages + master branches
Created December 11, 2018 15:08 — forked from mandiwise/Sync gh-pages + master branches
Keep gh-pages up to date with a master branch
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/
$ git add .
$ git status // to see what changes are going to be commited
$ git commit -m 'Some descriptive commit message'
$ git push origin master
$ git checkout gh-pages // go to the gh-pages branch
$ git rebase master // bring gh-pages up to date with master
$ git push origin gh-pages // commit the changes
var jurusan = [
{"id_jurusan_pendidikan":8,"nama":"Lainnya","jenjang_id":null},
{"id_jurusan_pendidikan":9,"nama":"Reakayasa Perangkat Lunak","jenjang_id":2},
{"id_jurusan_pendidikan":10,"nama":"Teknik komputer jaringan","jenjang_id":2},
{"id_jurusan_pendidikan":11,"nama":"Multimedia","jenjang_id":2},
{"id_jurusan_pendidikan":12,"nama":"Perhotelan","jenjang_id":2},
{"id_jurusan_pendidikan":13,"nama":"Administrasi perkantoran","jenjang_id":2},
{"id_jurusan_pendidikan":14,"nama":"IPS","jenjang_id":1},
{"id_jurusan_pendidikan":15,"nama":"IPA","jenjang_id":1},
{"id_jurusan_pendidikan":18,"nama":"Teknik Mesin","jenjang_id":4},
@nim4n136
nim4n136 / centos7-set-drupal8-permissions.sh
Last active February 17, 2019 15:56 — forked from merolhack/centos7-set-drupal8-permissions.sh
Set SELinux, ACL and common permissions to Drupal 8 over CentOs 7
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
# set -o xtrace
echo "0.- Reestablecer el contexto"
sudo restorecon -Rv /var/www/html
echo "1.- Cambiar propietario del webroot de Apache"
@nim4n136
nim4n136 / reload_forece_git.bash
Created February 17, 2019 17:31
Force reload .gitignore
#!/bin.bash
git rm -r --cached .
git reset HEAD --hard
git status
@nim4n136
nim4n136 / enable_rewrite_apache.md
Last active February 17, 2019 17:39
Enable rewrite module apache2 centos

Open

sudo vi /etc/httpd/conf/httpd.conf

Find the section and change AllowOverride None to AllowOverride All.

 <Directory /var/www/html>
    AllowOverride All
 </Directory>