Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode monitor
sudo iwconfig wlan0 txpower 30
sudo iwconfig wlan0 channel 1
sudo iwconfig wlan0 freq 2.412G
sudo iw dev wlan0 info
sudo tcpreplay -i wlan0 <filename>
@alexzaporozhets
alexzaporozhets / get_title_and_url.applescript
Created November 6, 2015 07:48 — forked from vitorgalvao/Get Title and URL.applescript
Applescript to get frontmost tab’s url and title of various browsers.
# Keep in mind that when asking for a `return` after another, only the first one will be output.
# This example is meant as a simple starting point, to show how to get the information in the simplest available way.
# Google Chrome
tell application "Google Chrome" to return URL of active tab of front window
tell application "Google Chrome" to return title of active tab of front window
# Google Chrome Canary
tell application "Google Chrome Canary" to return URL of active tab of front window
tell application "Google Chrome Canary" to return title of active tab of front window
# Chromium
#include <QtCore>
struct Task
{
Task(const QJsonObject &jsonObj)
{
project = jsonObj["project"].toString();
name = jsonObj["name"].toString();
description = jsonObj["description"].toString();
var Task = {
id: "{ID}",
name: "",
active: true,
projectId: "{projectId}",
folderId: "{folderId}",
integration: {
provider:"jira",
id:"TDWEB-3301"
},
@alexzaporozhets
alexzaporozhets / exampleOutput.h
Last active August 29, 2015 14:16
JSON schema 2 Qt class
struct Authorization
{
struct Company
{
Company()
{
}
Company(const Company &other)
{
@alexzaporozhets
alexzaporozhets / top-collection.js
Created February 24, 2015 11:29
Mongdb collections ordered by size
function bytesToSize(bytes) {
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes == 0) return '0 Byte';
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
};
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
@alexzaporozhets
alexzaporozhets / package.json
Created January 22, 2015 09:12
RabbitMQ + rabbitjs
{
"name": "rabbit",
"engines": {
"node": "0.10.x",
"npm": "1.4.x"
},
"dependencies": {
"rabbit.js": "~0.4.2"
}
}
@alexzaporozhets
alexzaporozhets / gist:8319591
Created January 8, 2014 16:26
Web Worker for Blob string
var blob = new Blob(["onmessage = function(e) { postMessage('msg from worker'); }"]);
// Obtain a blob URL reference to our worker 'file'.
var blobURL = window.URL.createObjectURL(blob);
var worker = new Worker(blobURL);
worker.onmessage = function (e) {
alert(e.data)
};
worker.postMessage('data');
@alexzaporozhets
alexzaporozhets / gist:8052124
Created December 20, 2013 08:50
Convert CRLF to LF (dos2unix)
# install on OSX
brew install dos2unix
# find all CRLF files
find . -not -type d -exec file "{}" ";" | grep CRLF
# convert all files to LF
find . -type f -print0 | xargs -0 dos2unix
# get count changed files
@alexzaporozhets
alexzaporozhets / gist:5812167
Created June 19, 2013 06:57
Install Oracle JAVA on Ubuntu 12.04 LTS
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer