Skip to content

Instantly share code, notes, and snippets.

@ildaroit
ildaroit / Print_ServerJobLogs.ps1
Created February 13, 2020 12:08 — forked from theagreeablecow/Print_ServerJobLogs.ps1
Print Server Job Logs from Event Viewer to CSV using Get-WinEvent and XML queries
<#
.SYNOPSIS
Print server job logs from Event Viewer to csv file
.DESCRIPTION
This script uses Get-WinEvent and XML queries to retrieve EventID 307 job logs from print servers.
Specifically querying the Microsoft-Windows-PrintService/Operational log.
Log is extracted to a CSV file and optionally emailed.
.PARAMETER FileName
@ildaroit
ildaroit / tellmeyoursecrets.js
Created May 28, 2019 07:36 — forked from woodwardtw/tellmeyoursecrets.js
google script that lists a lot of info about the files in a particular folder/sub folder structure including viewers, editors, and sharing permissions
function listFolders(folder) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow(["Name", "Sharing Access", "Sharing Permission", "Get Editors", "Get Viewers", "Date", "Size", "URL", "Download", "Description", "Type"]); //writes the headers
var folder = DriveApp.getFolderById("YOUR_FOLDER_ID");//that long chunk of random numbers/letters in the URL when you navigate to the folder
var files = folder.getFiles();//initial loop on loose files w/in the folder
var cnt = 0;
var file;
@ildaroit
ildaroit / reduce-jpgs-to-500px.sh
Created March 25, 2019 14:21 — forked from tmeits/reduce-jpgs-to-500px.sh
Reduce all JPEGs in folder to 500px wide and 75% quality using ImageMagick's mogrify
#!/bin/bash
mogrify -strip -type optimize -filter Cubic -resize 500x -quality 75% *.jpg
(function (history, trackingId, options) {
const generateId = () => {
return '_' + Math.random().toString(36).substr(2, 9);
};
const getId = () => {
if (!localStorage.cid) {
localStorage.cid = generateId()
}
return localStorage.cid;
};
@ildaroit
ildaroit / whois.php
Created November 25, 2018 07:32
PHP code to get WHOIS information of a domain
<?php
/*************************************************************************
php easy :: whois lookup script
==========================================================================
Author: php easy code, www.phpeasycode.com
Web Site: http://www.phpeasycode.com
Contact: webmaster@phpeasycode.com
*************************************************************************/
$domain = $_GET['domain'];
@ildaroit
ildaroit / gist:7c5994a170a1d0997b896176f895ad91
Created June 29, 2018 21:13 — forked from Lammerink/gist:3925106
PHP : Image Resize and Crop Using ImageMagick
<?php
// Image Resize and Crop using ImageMagick
// the Function
//imageresize to Thumb
function imageresize($src,$dest,$size=75){
list($w,$h) = getimagesize($src);
if($w > $h){
@ildaroit
ildaroit / optimize.php
Created June 29, 2018 18:32 — forked from fians/optimize.php
Optimize Image in PHP using Imagick according Google Pagespeed Recommendation
/**
* Optimize image image
*
* https://developers.google.com/speed/docs/insights/OptimizeImages
* -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB
*
* @access public
* @param string $filePath Path of the file
* @return string Raw image result from the process
*/
<?php
/**************************** простые гет запросы **********************/
/***********
отправить простой get запрос
************/
function get_curl_go($url){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
@ildaroit
ildaroit / insert-posts.php
Created December 15, 2017 21:49
Insert a post into WordPress from an external script
<?php
// Load WordPress
require_once 'path/to/www/wp-load.php';
require_once ABSPATH . '/wp-admin/includes/taxonomy.php';
// Set the timezone so times are calculated correctly
date_default_timezone_set('Europe/London');
// Create post
@ildaroit
ildaroit / countries.sql
Created December 1, 2017 22:13 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;