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
static String decodeCp1251(byte[] data) | |
{ | |
if (data == null) | |
{ | |
throw new IllegalArgumentException("Null argument"); | |
} | |
StringBuffer sb = new StringBuffer(data.length); | |
for (int i = 0; i < data.length; i++) | |
{ | |
sb.append(cp1251Map[data[i] & 0xFF]); |
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
$("body").append("<img src="+$("#photo img").attr("src")+" />"); |
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
<?php | |
function getThumb($url, $size="big") { | |
$size = (size === null) ? "big" : $size; | |
$p = "/([\\?&])v=([^&#]*)/i"; | |
// you can use parse_str to get video id | |
if(preg_match($p,$url,$results)){ | |
$vid = $results[2]; | |
if (size == "small") { | |
return "http://img.youtube.com/vi/" . $vid . "/2.jpg"; | |
} else { |
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 urllib | |
def fetch_thing(url, params, method): | |
params = urllib.urlencode(params) | |
if method=='POST': | |
f = urllib.urlopen(url, params) | |
else: | |
f = urllib.urlopen(url+'?'+params) | |
return (f.read(), f.code) | |
for x in range(0,30): | |
content, response_code = fetch_thing( |
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
ffmpeg -ss 00:01:20 -t 00:01:50 -i file.mp3 -acodec copy cutted.mp3 |
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
<?php | |
/* | |
* | |
// seen on | |
// http://stackoverflow.com/questions/4795385/how-do-you-use-bcrypt-for-hashing-passwords-in-php/6337021#6337021 | |
// usage | |
$bcrypt = new Bcrypt(15); | |
$hash = $bcrypt->hash('password'); |
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
# seean on http://www.commandlinefu.com/commands/view/9581/thepiratebay.org-torrent-search | |
# usage : | |
# tpb search | |
tpb() { wget -U Mozilla -qO - $(echo "http://thepiratebay.org/search/$@/0/7/0" | sed 's/ /\%20/g') | grep -o 'http\:\/\/torrents\.thepiratebay\.org\/.*\.torrent' | tac; } |
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
// seen in pinterest bookmarklet | |
function isIE() { | |
return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) | |
} | |
function isSafari() { | |
return /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) | |
} | |
function isIOS() { | |
return navigator.userAgent.match(/iPad/i) != null || navigator.userAgent.match(/iPhone/i) != null || navigator.userAgent.match(/iPod/i) != null || navigator.userAgent.match(/iPod/i) != null | |
} |
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
CREATE TABLE `isimler` ( | |
`id` int(10) NOT NULL AUTO_INCREMENT, | |
`ad` varchar(255) COLLATE utf8_bin NOT NULL, | |
`cinsiyet` varchar(50) COLLATE utf8_bin NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `ad` (`ad`), | |
KEY `cinsiyet` (`cinsiyet`) | |
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; | |
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
javascript:void((function(){var el=document.getElementById('_blogcu_genel');if(el!=null){Bel.parentNode.removeChild(el);}var e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src', 'http://www.blogcu.com/bookmarklet/bookmarklet.js?'+Math.floor(Math.random()*999999));document.body.appendChild(e)})()); |
OlderNewer