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
public interface LoginStrategy { | |
public void login(); | |
} | |
public class UsernamePasswordLogin implements LoginStrategy { | |
private String username; | |
private String 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
<?php | |
function sign_bcdn_url($url, $securityKey, $expiration_time = 3600, $user_ip = NULL, $is_directory_token = false, $path_allowed = NULL, $countries_allowed = NULL, $countries_blocked = NULL) | |
{ | |
if(!is_null($countries_allowed)) | |
{ | |
$url .= (parse_url($url, PHP_URL_QUERY) == "") ? "?" : "&"; | |
$url .= "token_countries={$countries_allowed}"; | |
} | |
if(!is_null($countries_blocked)) |
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 | |
# Get the total system memory in MB | |
total_memory=$(awk '/MemTotal/ {print $2}' /proc/meminfo) | |
# Calculate the amount of memory to use for PHP-FPM workers | |
memory_per_worker=$((total_memory / 8 / 1024)) | |
# Get the number of CPU cores | |
cpu_cores=$(grep -c ^processor /proc/cpuinfo) |
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 'dart:math'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatefulWidget { | |
@override | |
_MyAppState createState() => _MyAppState(); |
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 | |
header("Content-Type: text/xml; charset=utf-8"); | |
$url="https://www.google.com/tbproxy/spell?lang=en"; | |
$text = urldecode("mystary"); | |
$body = '<!--?xml version="1.0" encoding="utf-8" ?-->'; |
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
fun shouldUpgrade(server_version: String, app_version: String): Boolean { | |
if (server_version == app_version) { | |
return false | |
} | |
val versions = server_version.split(".") | |
val apps = app_version.split(".") |
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
@implementation NSString (url) | |
-(NSString *)urlEncodedString { | |
return [(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)self, NULL, CFSTR(":/?#[]@!$&’()*+,;="), kCFStringEncodingUTF8) autorelease]; | |
} | |
-(NSString *)urlDecodedString { | |
return [self stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
} | |
@end |
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
//bin2hex and hex2bin with Kotlin | |
import javax.xml.bind.DatatypeConverter | |
fun bin2hex(byteArray: ByteArray): String { | |
return DatatypeConverter.printHexBinary(byteArray); | |
} | |
fun hex2bin(binary: String): ByteArray { | |
return DatatypeConverter.parseHexBinary(binary) |
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
<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-size: small;"><b>Update :- Honeycomb (3.0) and Latest Gingerbread (2.3.3) links updated</b></span><br> | |
<br> | |
<br> | |
<h1>How to install Android SDK without internet connection ? </h1><br> | |
I searched all over the internet and found no posts like this, hence I'm making one hoping it would be helpful for a lot of people.<br> | |
<br> | |
<b>The magic URL is </b>- <a href="http://dl-ssl.google.com/android/repository/repository.xml">http://dl-ssl.google.com/android/repository/repository.xml</a><br> | |
That is the XML file from which the URL for downloading the SDK packages are obtained.<br> | |
<br> | |
For e.g. if you want to download Mac version of Android SDK for version 2.0, you could look up that XML file. You will find a block under tag SDK 2.0 like this<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
/** | |
* Created by saturngod on 28/11/17. | |
*/ | |
fun main(args:Array<String>) { | |
var k = "49085678237896" | |
print(getMMNumber(k)) | |
NewerOlder