Skip to content

Instantly share code, notes, and snippets.

{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"font_size": 8,
"ignored_packages":
[
"Vintage"
],
"tab_size": 4,
"theme": "Nexus.sublime-theme",
"bold_folder_labels": true,
@mslepko
mslepko / Preference.sublime-settings
Created March 18, 2014 22:56
ST3 User preferences
{
"atomic_save": false,
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"caret_extra_width": 1,
"caret_style": "solid",
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"enable_tab_scrolling": false,
"highlight_line": true,
"highlight_modified_tabs": true,
# Set prefix key to Ctrl-a
unbind-key C-b
set-option -g prefix C-a
bind-key C-a last-window
# send the prefix to client inside window
bind-key C-a send-prefix
# scrollback buffer n lines
set -g history-limit 5000
@mslepko
mslepko / gist:d7937acd98b81c7036e4af180bbb5c3f
Created September 15, 2016 23:56
PHP disable_functions - increasing security
Modify your php.ini file
- Ubuntu/Debian -/etc/php5/apache2/php.ini
- Centos/Rhel - /etc/php.ini
disable_functions = php_uname, getmyuid, getmypid, passthru, leak, listen, diskfreespace, tmpfile, link, ignore_user_abord, shell_exec, dl, set_time_limit, exec, system, highlight_file, source, show_source, fpaththru, virtual, posix_ctermid, posix_getcwd, posix_getegid, posix_geteuid, posix_getgid, posix_getgrgid, posix_getgrnam, posix_getgroups, posix_getlogin, posix_getpgid, posix_getpgrp, posix_getpid, posix, _getppid, posix_getpwnam, posix_getpwuid, posix_getrlimit, posix_getsid, posix_getuid, posix_isatty, posix_kill, posix_mkfifo, posix_setegid, posix_seteuid, posix_setgid, posix_setpgid, posix_setsid, posix_setuid, posix_times, posix_ttyname, posix_uname, proc_open, proc_close, proc_get_status, proc_nice, proc_terminate, phpinfo, apache_child_terminate, apache_setenv, ini_get_all, escapeshellcmd, escapeshellarg
# Return codes
OK=0
E_ARGS=1
E_INVALID=2
E_NOTEXIST=3
E_EXISTS=4
E_SUSPENDED=5
E_UNSUSPENDED=6
E_INUSE=7
E_LIMIT=8
@mslepko
mslepko / updown_widget.js
Last active May 16, 2021 12:53
iOS Scriptable uptown.io Widget
const api_domain = "https://updown.io/api/"
const api_key = "INSERT_YOUR_API_KEY_HERE"
let w = new ListWidget() // Create the widget
w.backgroundColor = Color.clear() // add transparent background
//w.url= "https://url.com" // an url to open on click
async function getChecks() {
const response = new Request(api_domain + '/checks?api-key=' + api_key);
@mslepko
mslepko / gist:f570ef591da44e18e59bcab0a30c463d
Last active January 31, 2023 10:16
Bash load average check and restart
!/bin/bash
function post_to_slack () {
# format message as a code block ```${msg}```
SLACK_MESSAGE="\`\`\`$1\`\`\`"
SLACK_URL=https://hooks.slack.com/services/UPDATE_THE_URL
case "$2" in
INFO)
SLACK_ICON=':slack:'
;;
@mslepko
mslepko / url_from_sitemap.php
Created October 14, 2023 10:31
PHP script to extract all urls from sitemap index file that contains other sitemaps
<?php
// extract sitemap urls from sitemap_index.xml
$urls = array();
$xml = simplexml_load_file('https://example.com/sitemap_index.xml');
foreach ($xml->sitemap as $sitemap) {
$sitemapUrl = (string) $sitemap->loc;
$sitemapXml = simplexml_load_file($sitemapUrl);
// Iterate through the URLs in the sitemap
@mslepko
mslepko / gist:288971e8f0d25da41c847cc403f2e441
Created November 15, 2023 17:10
Imports all .sql files in your current direcotry
#!/bin/bash
##
# Imports all .sql files in your current direcotry
##
for i in *.sql
do
echo "Importing: $i"
mysql your_db_name < $i
@mslepko
mslepko / phpcs.xml
Created March 14, 2024 10:02
phpcs config for WordPress related projects
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WordPress Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">
<description>The Coding standard for the WordPress.</description>
<file>.</file>
<exclude-pattern>/docroot/wp-admin/*</exclude-pattern>
<exclude-pattern>/docroot/wp-includes/*</exclude-pattern>
<exclude-pattern>/docroot/wp-*.php</exclude-pattern>