Skip to content

Instantly share code, notes, and snippets.

View inri13666's full-sized avatar

Nikita Makarov inri13666

View GitHub Profile
@inri13666
inri13666 / git_rebase.md
Created March 29, 2023 10:55 — forked from ravibhure/git_rebase.md
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@inri13666
inri13666 / php_unserialize_to_json.sql
Created July 23, 2021 20:09 — forked from storeman/php_unserialize_to_json.sql
PHP unserialize in Postgresql to json
/**
Decode a php serialized value to json. This function only supports basic
data types:
- arrays (will always become a json object)
- booleans
- integers
- floats
- strings
- NULL
@inri13666
inri13666 / azure-pipelines.yml
Created June 8, 2021 18:33 — forked from zanechua/azure-pipelines.yml
Azure Pipeline + Laravel + MySQL + PHPUnit + Laravel Dusk
# PHP
# Test and package your PHP project.
# Add steps that run tests, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/php
pool:
vmImage: 'Ubuntu 16.04'
variables:
phpVersion: 7.2
@inri13666
inri13666 / .htaccess
Created July 2, 2020 15:58
Better Security Drupal
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>

@fooMonster article worked for me

git ls-tree HEAD

100644 blob 55c0287d4ef21f15b97eb1f107451b88b479bffe script.sh As you can see the file has 644 permission (ignoring the 100). We would like to change it to 755:

git update-index --chmod=+x script.sh

commit the changes

git commit -m "Changing file permissions"

@inri13666
inri13666 / linix.md
Last active February 19, 2019 21:22
PHP File-system challenge
mkdir -p /tmp/test/realcachefolder/gretta
ln -s /tmp/test/realcachefolder /tmp/test/symlinkcachefolder
cd /tmp/test/symlinkcachefolder
php -r "var_dump(realpath('/tmp/test/symlinkcachefolder'));"
php -r "var_dump(__DIR__);"

create index.php with following content at /tmp/test/symlinkcachefolder

<?php 
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/

####systeminfo | findstr /B /C:"OS Version" /C:"System Type" /C:"System Locale"

OS Version:                10.0.14393 N/A Build 14393
System Type:               x64-based PC
System Locale:             en-us;English (United States)

####php -i | findstr /B /C:"PHP Version" /C:"Architecture" /C:"Compiler" /C:"Configure Command" /C:"Zend Extension Build" /C:"Client API library version" /C:"PostgreSQL(libpq)"

PHP Version => 7.0.7
+------------------+---------------------+------------------------+------------------------------------+----------+------+--+
| Province | Feed City | Google City | Google Neighbourhood | PostalC | Qnty | |
+------------------+---------------------+------------------------+------------------------------------+----------+------+--+
| Ontario | Brampton | Brampton | Churchville | L6Y4B5 | 13 | |
| Ontario | Toronto | Toronto | Willowdale | M2R1H9 | 39 | |
| Ontario | Toronto | Toronto | Midtown Toronto | M5R3T5 | 75 | |
| Ontario | Tiny | | Gilford | L0L1R0 | 4 | |
| Ontario | Lakeshore | | Belle River | N0R1A0 | 64 | |
| Ontario
@inri13666
inri13666 / config.yml.dist
Last active November 19, 2016 20:03
Demo for "phrets-core"
akuma:
phrets:
crea: #KeyAsAttribute
base_uri: 'http://sample.data.crea.ca/'
username: 'CXLHfDVrziCfvwgCuL8nUahC'
password: 'mFqMsCSPdnb5WO1gpEEtDCHH'
http_auth_method: ~
user_agent: ~