Skip to content

Instantly share code, notes, and snippets.

View ptflp's full-sized avatar
🤟
Quality over quantity?

Petr Filippov ptflp

🤟
Quality over quantity?
View GitHub Profile
@ptflp
ptflp / mouse_move_slider.html
Created July 28, 2018 00:51
Slider on mouse move
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.item-photo {
position: relative;
overflow: hidden;
margin: 0px;
[
{ "keys": ["ctrl+shift+s"], "command": "auto_save" },
{ "keys": ["ctrl+alt+t"], "command": "delete_trailing_spaces" },
{ "keys": ["ctrl+b"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["ctrl+space"], "command": "move_to", "args": {"to": "eol", "extend": false} }
]
@ptflp
ptflp / index.js
Created July 6, 2018 23:55
nodejs googleapis example
const google = require('googleapis');
const KEY = require('./mykey.json');
getAllUsers();
/* CREATE CONNECTION, get instance of jwtClient */
function connect() {
return new Promise((yep, nope) => {
const jwtClient = new google.auth.JWT(
@ptflp
ptflp / 1.txt
Created July 1, 2018 15:42
python bcdedit parser
идентификатор {bootmgr}
device partition=\Device\HarddiskVolume8
path \EFI\Microsoft\Boot\bootmgfw.efi
description Windows Boot Manager
locale ru-RU
inherit {globalsettings}
default {current}
resumeobject {123123421}
displayorder {current}
{214214421}
@ptflp
ptflp / HyperV-switch-VirtualBox.ps1
Last active July 1, 2018 15:17
Set easy switching between Hyper-V and Virtualbox at startup. Run from powershell once, if you run multiple times, go to msconfig and delete excess entry.
param([switch]$Elevated)
function Check-Admin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
if ((Check-Admin) -eq $false) {
if ($elevated)
{
# could not elevate, quit
}
@ptflp
ptflp / MySQL.ps1
Created June 26, 2018 14:45
Using MySQL from powershell
Param(
[Parameter(
Mandatory = $true,
ParameterSetName = '',
ValueFromPipeline = $true)]
[string]$Query
)
$MySQLAdminUserName = 'USER'
$MySQLAdminPassword = 'PASSWORD'
$MySQLDatabase = 'MYDBNAME'
@ptflp
ptflp / docker.ps1
Last active June 19, 2018 12:40
Yii2 gulp 4 file reference
docker-compose up -d
@ptflp
ptflp / gulpfile.js
Last active June 20, 2018 01:02
Gulp 4 installation
var
gulp = require("gulp"),
browserSync = require('browser-sync').create(),
childProcess = require('child_process');
gulp.task('docker-start', function (callback) {
console.log("---------Start--------------------------");
return childProcess.exec('Powershell.exe -executionpolicy remotesigned -File docker.ps1', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
@ptflp
ptflp / config.inc.php
Created June 8, 2018 06:11
phpmyadmin autologin autorization configuration
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
/* Ensure we got the environment */
$vars = array(
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
'PMA_VERBOSE',
@ptflp
ptflp / initdb
Last active March 15, 2018 21:17
install yii2 for ptflp/yii2 dockerized Yii2-application
#!/usr/bin/env php
<?php
if (defined('STDIN')) {
$hostdb = $argv[1];
$dbname = $argv[2];
$userdb = $argv[3];
$passdb = $argv[4];
}
$servername = $hostdb;
$username = $userdb;