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
#!/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 | |
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
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
//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
/** | |
* Created by saturngod on 28/11/17. | |
*/ | |
fun main(args:Array<String>) { | |
var k = "49085678237896" | |
print(getMMNumber(k)) | |
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
NSMutableArray *res2 = [[NSMutableArray alloc] initWithArray:@[@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23,@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23,@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23,@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23]]; | |
int passnum = res2.count -1 ; | |
BOOL exchange = YES; | |
NSDate *date = [NSDate date]; | |
while (passnum >0 && exchange) { | |
exchange = false; | |
for (int i = 0 ; i < passnum ; 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
var tester = VerEx() | |
.then( "http" ) | |
.maybe( "s" ) | |
.then( "://" ) | |
.maybe( "www." ) | |
.anythingBut( " " ); | |
// Create an example URL | |
var testMe = "This is testing. https://www.google.com is a URL. http://www.facebook.com also URL."; | |
var result = testMe.match(tester); |
NewerOlder