Skip to content

Instantly share code, notes, and snippets.

@kulbakin
kulbakin / .htaccess
Created February 8, 2016 07:00
Common apache .htaccess redirects
RewriteEngine On
# force www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* http://www.%{HTTP_HOST}/$0 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}/$0 [R=301,L]
@kulbakin
kulbakin / remove-spyware-win.bat
Last active February 7, 2022 11:31
Remove Windows Spyware aka Telemetry Updates
@echo off
color 0E
echo Removing Windows 7 and 8.1 spyware updates.
echo To remove "spyware" updates open Command Prompt as Administrator by clicking
echo right mouse button.
echo Sometimes you need to run this file several times till "get-hotfix" no longer
echo find spyware updates (for ex. KB2952664 and others).
echo Before running the tool disable automatic update installation in Windows Update
echo Center. After updates are deleted, check for updates and hide ones from this
echo list for them not to get istalled again, then you can re-enable auto updates.
@kulbakin
kulbakin / timezones.php
Last active August 24, 2023 10:57
Array of timezones where keys are PHP timezone names and values are human friendly timezone titles.
<?php
/**
* List of timezones
*/
return array(
'Pacific/Midway' => '(UTC-11:00) Midway',
'Pacific/Niue' => '(UTC-11:00) Niue',
'Pacific/Pago_Pago' => '(UTC-11:00) Pago Pago',
'America/Adak' => '(UTC-10:00) Adak',
'Pacific/Honolulu' => '(UTC-10:00) Honolulu',
@kulbakin
kulbakin / d3star.js
Last active December 18, 2015 18:39
JavaScript function to compose coordinates of svg path to represent a star
/**
* Compose coordinates of svg path to represent a star
* @param int size
* @return string
*/
var d3_star = function (size) {
var d18 = Math.PI / 10,
d36 = d18 * 2,
sind18 = Math.sin(d18),