Skip to content

Instantly share code, notes, and snippets.

View ishansharma's full-sized avatar

Ishan Sharma ishansharma

View GitHub Profile
@ishansharma
ishansharma / hdfs-site.xml
Created February 16, 2019 21:12
hdfs-site.xml for vagrant
<?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 February 16, 2019 21:09
Hadoop core-site.xml config for Vagrant
<?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 February 16, 2019 21:06
Generate SSH Key and Add to Authorized Keys
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 February 16, 2019 21:04
Hadoop Environment Variables
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 February 16, 2019 21:02
Adding Hadoop Exports to .bashrs
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 September 27, 2018 02:47
A sample of how /var/db/.com.apple.iokit.graphics is structured on macOS
<?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 June 4, 2017 17:53
Send all results for a post type with WordPress
<?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 June 4, 2017 16:01
WP API Error when more than 100 posts are requested
{
"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 06:13
Setting an User Agent with curl
<?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 05:51
Response by iThemes Security Plugins when blocking HTTP Requests
<!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