This file contains 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
function handleMessage(data) { | |
if( typeof data == 'string' ) { | |
var strUtf8 = unescape( encodeURIComponent( data ) ); | |
var ab = new Uint8Array( strUtf8.length ); | |
var le = strUtf8.length; | |
for ( var i = 0; i < le; i++ ) { | |
ab[i] = strUtf8.charCodeAt(i); | |
} | |
data = ab; |
This file contains 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
function getElementByXpath(path) { | |
var result = document.evaluate(path, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); | |
for (var i = result.snapshotLength - 1; i >= 0; i--){ | |
console.log(result.snapshotItem(i)); | |
} | |
} |
This file contains 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
/* | |
* File: main.cpp | |
* Author: emrahgunduz | |
* | |
* Created on March 12, 2013, 3:57 PM | |
*/ | |
#include <iostream> | |
using namespace std; |
This file contains 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
sshfs -o reconnect -C -o workaround=all -o allow_other -p 56987 root@10.129.0.230:/root/backup/ /root/backup |
This file contains 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
for f in *.m4a; do g=`basename $f .m4a`; ffmpeg -i $f $g.mp3 || echo FAILED; done |
This file contains 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
function generateRainbowColors(count, createDiv){ | |
function rainbow(numOfSteps, step) { | |
var r, g, b; | |
var h = step / numOfSteps; | |
var i = ~~(h * 6); | |
var f = h * 6 - i; | |
var q = 1 - f; | |
switch(i % 6){ | |
case 0: r = 1; g = f; b = 0; break; |
This file contains 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
function generateRainbowColors(count, createDiv, frequency1, frequency2, frequency3, phase1, phase2, phase3, center, width) { | |
var colors = []; | |
if(!count) count = 50; | |
if(!createDiv) createDiv = false; | |
if(!center) center = 128; | |
if(!width) width = 127; | |
if(!frequency1) frequency1 = .3; | |
if(!frequency2) frequency2 = .3; |
This file contains 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 UIKit | |
class ViewController: UIViewController { | |
func addTheBlurView(data :Data) { | |
let generalFrame = self.view.bounds; | |
let parentView = UIView(frame: generalFrame) | |
self.view.addSubview(parentView) |
This file contains 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
#!/bin/bash | |
#add routes for secondary IP addresses | |
MAC_ADDR=$(ifconfig eth0 | sed -n 's/.*ether \([a-f0-9:]*\).*/\1/p') | |
IP=($(curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/$MAC_ADDR/local-ipv4s)) | |
for ip in ${IP[@]:1}; do | |
echo "Adding IP: $ip" | |
ip addr add dev eth0 $ip/20 | |
done |
This file contains 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
length = 50 | |
n = 2 | |
first_numerator = 3 | |
first_denominator = 1 | |
second_numerator = 8 | |
second_denominator = 3 | |
result = [] | |
for i in xrange(length): | |
x = n |
OlderNewer