CREATE STREAM APARAT_WATCH (ip VARCHAR, req_ip VARCHAR, vid BIGINT, uid VARCHAR, userid BIGINT, afcn VARCHAR, session_id VARCHAR, profile VARCHAR, watch DOUBLE, progress DOUBLE, position BIGINT, duration VARCHAR, timestamp BIGINT, payload_time BIGINT, chunkname VARCHAR, download INTEGER, watch_type VARCHAR) WITH (kafka_topic='aparat_watch', value_format='JSON', timestamp='timestamp');
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
{ | |
"sheba": { | |
"55": "اقتصاد نوین", | |
"63": "انصار", | |
"69": "ایران زمین", | |
"54": "پارسیان", | |
"57": "پاسارگاد", | |
"21": "پست بانک", | |
"62": "آینده", | |
"18": "تجارت", |
I just didn't like the way Retrofit is calling methods and I wanted to improve it. I believe error handling can be done much nicer. Here is what I did.
Preparing web service object to call remote methods:
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://example.com/web-api/v1/")
.addConverterFactory(GsonConverterFactory.create())
.build();
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 | |
set_time_limit(0); | |
session_start(); | |
print $_SESSION['something']; |
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
mkdir keys # All keys will be generated in this folder | |
openssl genrsa -out keys/rootCA.key 2048 -des3 # CA Private key | |
openssl req -x509 -new -nodes -key keys/rootCA.key -days 1024 -out keys/rootCA.pem # CA self-signed certificate valid for 1024 days | |
# CA certificate should be imported to all devices that are using these self-signed certificates | |
openssl genrsa -out keys/server.key 2048 # Server private key | |
openssl req -new -key keys/server.key -out keys/server.csr # Server certificate signing request | |
openssl x509 -req -in keys/server.csr -CA keys/rootCA.pem -CAkey keys/rootCA.key -CAcreateserial -out keys/server.crt -days 1024 # Common Name should be server's host name or ip |
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 | |
// This will always make a writable folder with "0755" permission | |
mkdir('/some/path', 0777); | |
// But this won't! this will make folder with "1352" permission | |
mkdir('/some/path', 777); |
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:window.links=[];$('.soundTitle__title').each(function(index,item){window.links.push(item.href.replace('soundcloud.com','soundcloud2mp3.com')+'/download')});document.write(window.links.join('<br>')); |
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 | |
/** | |
* Gets public methods name of a class only defined in that class, | |
* not it's parent | |
* | |
* @param string $className Name of the class. | |
* | |
* @return array Returns list of methods. | |
*/ |
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
var Class = (function Class() { | |
var singleton_private_variable = 'Singleton Private variable'; | |
function singleton_private_function () { | |
return 'Private Function'; | |
} | |
var Obj = { | |
singleton_public_variable: 'Singleton Public variable', |
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 | |
define("GOOGLE_MAGIC", 0xE6359A60); | |
function zeroFill($a, $b) | |
{ | |
$z = hexdec(80000000); | |
if ($z & $a) { | |
$a = ($a >> 1); | |
$a &= (~$z); |
NewerOlder