Skip to content

Instantly share code, notes, and snippets.

Avatar

Ishan Sharma ishansharma

View GitHub Profile
@ishansharma
ishansharma / hdfs-site.xml
Created Feb 16, 2019
hdfs-site.xml for vagrant
View hdfs-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@ishansharma
ishansharma / core-site.xml
Created Feb 16, 2019
Hadoop core-site.xml config for Vagrant
View core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@ishansharma
ishansharma / ssh_gen.sh
Created Feb 16, 2019
Generate SSH Key and Add to Authorized Keys
View ssh_gen.sh
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat /home/vagrant/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
@ishansharma
ishansharma / hadoop_env.sh
Created Feb 16, 2019
Hadoop Environment Variables
View hadoop_env.sh
echo "export JAVA_HOME=/usr" | sudo tee --append /usr/local/bin/hadoop/etc/hadoop/hadoop-env.sh
echo "export HADOOP_LOG_DIR=/hadoop_logs" | sudo tee --append /usr/local/bin/hadoop/etc/hadoop/hadoop-env.sh
echo "export HDFS_NAMENODE_USER=\"vagrant\"" | sudo tee --append /usr/local/bin/hadoop/etc/hadoop/hadoop-env.sh
echo "export HDFS_DATANODE_USER=\"vagrant\"" | sudo tee --append /usr/local/bin/hadoop/etc/hadoop/hadoop-env.sh
echo "export HDFS_SECONDARYNAMENODE_USER=\"vagrant\"" | sudo tee --append /usr/local/bin/hadoop/etc/hadoop/hadoop-env.sh
echo "export YARN_RESOURCEMANAGER_USER=\"vagrant\"" | sudo tee --append /usr/local/bin/hadoop/etc/hadoop/hadoop-env.sh
echo "export YARN_NODEMANAGER_USER=\"vagrant\"" | sudo tee --append /usr/local/bin/hadoop/etc/hadoop/hadoop-env.sh
@ishansharma
ishansharma / hadoop_exports.sh
Created Feb 16, 2019
Adding Hadoop Exports to .bashrs
View hadoop_exports.sh
echo "export JAVA_HOME=/usr" >> /home/vagrant/.bashrc
echo "export HADOOP_LOG_DIR=/hadoop_logs" >> /home/vagrant/.bashrc
echo "export PATH=\$PATH:/usr/local/bin/hadoop/bin:/usr/local/bin/hadoop/sbin" >> /home/vagrant/.bashrc
source ~/.bashrc
@ishansharma
ishansharma / .com.apple.iokit.graphics
Last active Sep 27, 2018
A sample of how /var/db/.com.apple.iokit.graphics is structured on macOS
View .com.apple.iokit.graphics
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/IGPU@2/AppleIntelFramebuffer@0/display0/AppleBacklightDisplay-610-a029</key>
<dict>
<key>startup-timing</key>
<data>
AAAAAAAAAIAAcACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB
AAAAIPwAEAAAAAAg/AAQAAAAACD8ABAAAAAAAAoAAKAAAAAwAAAAIAAAAEAG
@ishansharma
ishansharma / wp_all_posts.php
Created Jun 4, 2017
Send all results for a post type with WordPress
View wp_all_posts.php
<?php
add_action( 'rest_customer_query', 'customer_override_per_page' );
/*
* params is the query array passed to WP_Query
*/
function customer_override_per_page( $params ) {
if ( isset( $params ) AND isset( $params[ 'posts_per_page' ] ) ) {
$params[ 'posts_per_page' ] = PHP_INT_MAX;
}
@ishansharma
ishansharma / error.json
Created Jun 4, 2017
WP API Error when more than 100 posts are requested
View error.json
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): per_page",
"data": {
"status": 400,
"params": {
"per_page": "per_page must be between 1 (inclusive) and 100 (inclusive)"
}
}
}
@ishansharma
ishansharma / curl_user_agent.php
Created May 9, 2017
Setting an User Agent with curl
View curl_user_agent.php
<?php
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($this->data));
curl_setopt($ch, CURLOPT_USERAGENT, 'Name of your service'); // this is where user agent is set
@ishansharma
ishansharma / ithemes_security_response.txt
Created May 9, 2017
Response by iThemes Security Plugins when blocking HTTP Requests
View ithemes_security_response.txt
<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>403 Forbidden</title>\n</head><body>\n<h1>Forbidden</h1>\n<p>You don't have permission to access /v1/validate\non this server.<br />\n<br />\nPossible causes of this error include:</p>\n<ol>\n<li>The request was forbidden by rules in the .htaccess file.</li>\n<li>The directory you requested does not have an index.html or index.php file.</li>\n<li>The permissions on the file or directory are incorrect.</li>\n</ol>\n<p>For details about why the request was forbidden, see the Apache error log at:</p>\n<pre>/srv/users/SYSUSER/log/APPNAME/APPNAME_apache.error.log</pre>\n<p><br /><br /><b>\n</b></p>\n</body></html>\n