Skip to content

Instantly share code, notes, and snippets.

View nmoinvaz's full-sized avatar

Nathan Moinvaziri nmoinvaz

  • Phoenix, United States
View GitHub Profile
@heckj
heckj / gist:1187999
Created September 2, 2011 05:57
Get MAC addresses of all interfaces
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <ifaddrs.h>
#include <errno.h>
#include <net/if_dl.h>
@fincs
fincs / main.cpp
Created May 19, 2012 22:37
Fully native C++ WinRT (Metro-style) app
//
// Fully native C++ WinRT application example
// Programmed by fincs
//
#include <windows.h>
#include <roapi.h>
#include <wchar.h>
#include <stdio.h>
#include <stdlib.h>
@p0rsche
p0rsche / gist:2763377
Created May 21, 2012 17:17
jQuery.extend implementation in pure JS
var utils = function(){
"use strict";
var _class2type = {};
var _type = function( obj ) {
return obj == null ?
String( obj ) :
_class2type[ toString.call(obj) ] || "object";
};
@bentsai
bentsai / gist:3150936
Created July 20, 2012 14:11
The jQuery.extend function
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
@ralphbean
ralphbean / flickr-scraper.py
Last active January 15, 2022 23:43
Script to scrape images from a flickr account.
#!/usr/bin/env python
""" Script to scrape images from a flickr account.
Author: Ralph Bean <rbean@redhat.com>
"""
import ConfigParser
import urllib
import requests
@bdeleasa
bdeleasa / wp-domain-masking.php
Created April 14, 2016 15:19
Wordpress plugin that removes the X-Frame-Options header to allow for domain masking.
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link http://example.com
add_filter('upload_dir', 'cdn_upload_url');
function cdn_upload_url($args)
{
if (!is_admin()) {
$args['baseurl'] = 'https://your-awesome-cdn.net/wp-content/uploads';
}
return $args;
}
@scottgulliver
scottgulliver / checkout_branches.ps1
Created January 31, 2018 12:03
Powershell script to checkout all remote git branches
git branch -r | Select-String -Pattern "->" -NotMatch | Select-String -pattern "^ origin/" | foreach { $_ -replace '^ origin/', '' } | Foreach { git checkout $_ }
//
// Author: Jonathan Blow
// Version: 1
// Date: 31 August, 2018
//
// This code is released under the MIT license, which you can find at
//
// https://opensource.org/licenses/MIT
//
//