Skip to content

Instantly share code, notes, and snippets.

@roidayan
roidayan / config_for_mitmproxy.sh
Created November 17, 2018 18:00
arpspoof and mitmproxy script
#!/bin/bash
DEV=wlan0
VICTIM_IP=192.168.1.3
GATEWAY_IP=`ip r | grep default | awk {'print $3'}`
echo dev $DEV
echo gateway $GATEWAY_IP
echo victim $VICTIM_IP
@roidayan
roidayan / tocsv.js
Created November 2, 2015 12:18 — forked from JeffJacobson/tocsv.js
JavaScript object to CSV
/**
* Converts a value to a string appropriate for entry into a CSV table. E.g., a string value will be surrounded by quotes.
* @param {string|number|object} theValue
* @param {string} sDelimiter The string delimiter. Defaults to a double quote (") if omitted.
*/
function toCsvValue(theValue, sDelimiter) {
var t = typeof (theValue), output;
if (typeof (sDelimiter) === "undefined" || sDelimiter === null) {
sDelimiter = '"';
@roidayan
roidayan / lang.service.js
Created October 25, 2015 05:29
Angular language service to detection locale in phonegap and browser.
(function(){
'use strict';
angular
.module('app')
.service('langService', [
langService
]);
function langService() {
@roidayan
roidayan / autofocus.directive.js
Last active November 16, 2015 19:44 — forked from mlynch/autofocus.js
AngularJS Autofocus directive
/**
* the HTML5 autofocus property can be finicky when it comes to dynamically loaded
* templates and such with AngularJS. Use this simple directive to
* tame this beast once and for all.
*
* Usage:
* <input type="text" autofocus="true">
*
* License: MIT
*/
@roidayan
roidayan / debounce.service.js
Created September 12, 2015 07:14
debounce service
angular
.module('app')
.factory('debounce', ['$timeout', DebounceService]);
function DebounceService($timeout) {
return function(func, wait) {
var timeout, args, context, result;
function debounce() {
@roidayan
roidayan / scroll.directive.js
Created September 11, 2015 14:39
hide and show angular material fab button on scroll
(function(){
'use strict';
angular
.module('app')
.directive('appScroll', ['$window', ScrollDirective]);
function ScrollDirective($window) {
return {
restrict: 'A',
@roidayan
roidayan / timeago.filter.js
Last active September 11, 2015 08:32 — forked from rodyhaddad/timeago.filter.js
timeago filter for angularjs
.filter("timeago", function () {
//time: the time
//local: compared to what time? default: now
//raw: wheter you want in a format of "5 minutes ago", or "5 minutes"
return function (time, local, raw) {
if (!time)
return "never";
if (!local) {
local = Date.now();