This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Change the MAC address of a given interface. | |
| # Usage: sudo ./change-mac.bash <interface name> [<new mac address>] | |
| # Example: sudo ./change-mac.bash wlan0 11:99:22:88:33:77 | |
| # Author: @richin13 | |
| if [ "$#" -lt 1 ]; then | |
| echo "Usage: $0 <interface name> [mac address]" | |
| exit 1 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias.a add . | |
| alias.aliases config --get-regexp alias | |
| alias.bi bisect | |
| alias.ci commit -m | |
| alias.co checkout | |
| alias.colast checkout - | |
| alias.db branch -D | |
| alias.laf fsck --lost-found | |
| alias.last log -1 HEAD | |
| alias.nb checkout -b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env/python | |
| # | |
| # More of a reference of using jinaj2 without actual template files. | |
| # This is great for a simple output transformation to standard out. | |
| # | |
| # Of course you will need to "sudo pip install jinja2" first! | |
| # | |
| # I like to refer to the following to remember how to use jinja2 :) | |
| # http://jinja.pocoo.org/docs/templates/ | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| UDP_IP = "::1" # localhost | |
| UDP_PORT = 5005 | |
| MESSAGE = "Hello, World!" | |
| print "UDP target IP:", UDP_IP | |
| print "UDP target port:", UDP_PORT | |
| print "message:", MESSAGE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) 2014 Justin W. Smith | |
| # Don't be evil! | |
| require 'base64' | |
| require 'socket' | |
| require 'optparse' | |
| options = {port: 443} | |
| optparser = OptionParser.new do |opts| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import unittest | |
| class Node: | |
| def __init__(self, key, data): | |
| self.key = key | |
| self.data = data | |
| self.left = None | |
| self.right = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Post < ActiveRecord::Base | |
| # for SO: http://stackoverflow.com/questions/10481389/friendly-id-with-two-parameters | |
| # EXAMPLE ASSUMES YOU ARE USING FRIENDLYID 4.X | |
| # AND THAT YOU HAVE A SLUG:STRING COLUMN ON THE MODEL | |
| # ... | |
| extend FriendlyId | |
| friendly_id :generate_custom_slug, :use => :slugged | |
| # ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Runs a folder of tests or a single test, using QUnit and outputs a JUnit xml file ready for sweet integration with your CI server. | |
| // | |
| // @usage | |
| // DISPLAY=:0 phantomjs qunit-runner.js --qunit qunit.js --tests tests-foler/ --package package.json --junit qunit-results.xml | |
| // | |
| // package.json is a common JS package file which contains a list of files that need to be loaded before the tests are run. In this instance | |
| // the package.json lists the files for a JS SDK, that gets loaded and then the tests test the SDK. | |
| // | |
| // Designed to run via PhantomJS. |
NewerOlder