Skip to content

Instantly share code, notes, and snippets.

View kashmiry's full-sized avatar
🌊
Flowing

Kash kashmiry

🌊
Flowing
View GitHub Profile
@andreleoni
andreleoni / automatic_crontab.sh
Last active January 30, 2024 14:27
automatic crontab for automatic mysql/mariadb backup/mysqldump on linux
# Access crontab -e
crontab -e
# Create a CRON like this
30 10 * * * ~/autobackup.sh
# Create autobackup file
touch ~/autobackup.sh
# autobackup.sh content
@chethann
chethann / WebviewResourceMappingHelper.java
Created November 24, 2017 09:19
WebviewResourceMappingHelper Sample Code
package com.test.android.helpers;
import android.os.Build;
import android.webkit.WebResourceResponse;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.test.android.Application;
import org.apache.commons.collections.CollectionUtils;
@dduvnjak
dduvnjak / add_cloudflare_ips.sh
Last active June 26, 2024 07:47
Add CloudFlare IP addresses to an EC2 Security Group using awscli
# first we download the list of IP ranges from CloudFlare
wget https://www.cloudflare.com/ips-v4
# set the security group ID
SG_ID="sg-00000000000000"
# iterate over the IP ranges in the downloaded file
# and allow access to ports 80 and 443
while read p
do
@sethbergman
sethbergman / WP-HTML-Compression
Created November 3, 2015 03:27
Minify HTML for WordPress without a Plugin - Add to function.php
<?php
class WP_HTML_Compression
{
// Settings
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
protected $remove_comments = true;
// Variables
@mcaskill
mcaskill / Function.Array-Group-By.php
Last active January 3, 2024 10:15
PHP : Groups an array by a given key
<?php
if (!function_exists('array_group_by')) {
/**
* Groups an array by a given key.
*
* Groups an array into arrays by a given key, or set of keys, shared between all array members.
*
* Based on {@author Jake Zatecky}'s {@link https://github.com/jakezatecky/array_group_by array_group_by()} function.
* This variant allows $key to be closures.
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active July 12, 2024 14:34
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@garlandkr
garlandkr / ami-clean.sh
Last active May 31, 2024 10:38
Clean-up an Amazon EC2 instance before creating an AMI
#!/bin/bash
# Run this script with:
# bash <(curl -s https://gist.github.com/garlandkr/e80674b49270b0199fa6/raw/ami-clean.sh
function print_green {
echo -e "\e[32m${1}\e[0m"
}
print_green 'Clean Yum'
@abrudtkuhl
abrudtkuhl / admin_filter_by_custom_fields.php
Created July 22, 2014 20:13
WordPress Filter Posts By Custom Field Value In Admin
<?php
/*
Plugin Name: Admin Filter BY Custom Fields
Plugin URI: http://en.bainternet.info
Description: Filter posts or pages in admin by custom fields (post meta)
Version: 1.0
Author: Bainternet
Author URI: http://en.bainternet.info
*/
@Pushplaybang
Pushplaybang / wp-admin-bar-tweaks.php
Created August 9, 2013 23:34
wp-admin-bar-tweaks
Disable the WordPress Admin Bar for all Users and Visitors
Turn off the toolbar with one simple line.
view plain
/*
* Disable the WordPress Admin Bar for all Users and Visitors
*/
remove_action( 'init', '_wp_admin_bar_init' );
^ top
Enable the WordPress Admin Bar for admins only
@jedihe
jedihe / config-3.4.10.1deb1.inc.php
Last active February 2, 2023 20:35
PhpMyAdmin config file with autologin enabled (user/pass: root/root). Useful for private development environments, USE AT YOUR OWN RISK. Copied from install on Ubuntu Server 12.04.
<?php
/**
* Debian local configuration file
*
* This file overrides the settings made by phpMyAdmin interactive setup
* utility.
*
* For example configuration see
* /usr/share/doc/phpmyadmin/examples/config.sample.inc.php
* or