Skip to content

Instantly share code, notes, and snippets.

View daniyalzade's full-sized avatar

Eytan Daniyalzade daniyalzade

View GitHub Profile
@daniyalzade
daniyalzade / references.md
Created July 21, 2016 16:38
Node JS References
@daniyalzade
daniyalzade / mint_categories.json
Created February 1, 2015 21:05
mint_categories.json
{
"Personal Care": [
"Hair",
"Laundry",
"Spa & Massage"
],
"Entertainment": [
"Amusement",
"Arts",
"Movies & DVDs",
@daniyalzade
daniyalzade / parallelConnections.js
Created November 7, 2014 18:54
parallelConnections.js
var async = require('async');
var http = require('http');
var URL = 'www.walmart.com';
var MAX_SOCKETS = 50;
var NUM_CONNECTIONS = 100;
http.globalAgent.maxSockets = MAX_SOCKETS;
@daniyalzade
daniyalzade / detect_app.js
Created October 8, 2013 14:30
Fancy's way of detecting if app exists and launching app accordingly. It does referrer checking to see if the link is coming from email, and only does it then.
<script>
var thing_id = "441444475001111765";
$('.thing-related-photo img').each(function(){
if($(this).width()>$(this).height()){
$(this).css("height","60px");
}else{
$(this).css("width","60px");
}
});
@daniyalzade
daniyalzade / python_us_states.py
Created May 6, 2013 13:03
map of abbreviation to full name for all US states
states = {
'AK': 'Alaska',
'AL': 'Alabama',
'AR': 'Arkansas',
'AS': 'American Samoa',
'AZ': 'Arizona',
'CA': 'California',
'CO': 'Colorado',
'CT': 'Connecticut',
'DC': 'District of Columbia',
@daniyalzade
daniyalzade / getURLParameter.js
Created January 21, 2013 17:02
Get URL parameter in javascript
function getURLParameter(name) {
var val = (RegExp('[?|&]' + name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1];
return val ? decodeURI(val) : val;
}
# MySQL get number of rows per table
select TABLE_NAME, TABLE_ROWS, DATA_LENGTH from INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'db_name';
# Delete vim files
rm -rf ls -l **/.*.swp
# Find large ( 100MB > ) files
sudo find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
@daniyalzade
daniyalzade / adv_enumerate.py
Created November 18, 2012 23:12
Log progress while iterating over a list
import logging
def _display_msg(msg, use_print=False):
"""
@param msg: str
@param use_print: bool
"""
if use_print:
print msg
return
@daniyalzade
daniyalzade / check_cluster.py
Created November 13, 2012 17:39
Nagios Plugin For Checking Uptime in a Cluster (over multiple hosts)
#!/usr/bin/env python
# Script to enure that the cluster defined by the hostgroup, or list
# hosts has enough healthy nodes as defined by the 'check_ping' plugin.
# If it has more than N number of unhealthy nodes, the plugin returns
# the appropriate error.
#
# To get the list of hosts from a hostgroup, this script parses nagios'
# hosts.cfg file which has the following format:
#
@daniyalzade
daniyalzade / product_api.json
Created July 25, 2012 04:02
product_api.json
{
data: {
products: [
{
seo_title: "for_all_mankind_gwenevere_low-rise",
category_id: 237,
title: "7 for all mankind Gwenevere low-rise skinny jeans",
url: "http://www.net-a-porter.com/product/196792",
display_price: "$205",
price: "205",