This file contains hidden or 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
""" | |
It is based on java implementation: https://datatracker.ietf.org/doc/html/rfc6238#appendix-A | |
""" | |
import datetime | |
import hashlib | |
import hmac | |
from typing import Callable | |
def main(): |
This file contains hidden or 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
<!doctype html> | |
<html> | |
<head> | |
<title>Site Maintenance</title> | |
<meta charset="UTF-8"> | |
<style> | |
body { text-align: center; padding: 150px; } | |
h1 { font-size: 50px; } | |
body { font: 20px Helvetica, sans-serif; color: #333; } | |
article { display: block; text-align: left; width: 650px; margin: 0 auto; } |
This file contains hidden or 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
const AWS = require("aws-sdk"); | |
const dbClient = new AWS.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); | |
exports.handler = async (event) => { | |
let params = JSON.parse(event.body); | |
await dbClient.put({ | |
TableName: 'users', | |
Item: { | |
email: params.email, | |
name: params.name |
This file contains hidden or 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 -p /data/projects | |
apt-get install -y apache2 php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-soap php-pear php-bcmath libapache2-mod-php software-properties-common certbot python3-certbot-apache zip unzip | |
a2enmod rewrite | |
systemctl restart apache2 | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
php composer-setup.php | |
mv composer.phar /usr/local/bin/composer | |
unlink composer-setup.php |
This file contains hidden or 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
{ | |
"product_variants": [ | |
{ | |
"type": "Color", | |
"items": [ | |
{ | |
"id": "26a702b2", | |
"name": "Beyaz" | |
}, | |
{ |
This file contains hidden or 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
{% set home_value = 560000 %} | |
{% set down_payment = home_value * 0.05 %} | |
{% set loan_term = 25 %} | |
{% set interest_rate = 3.19 %} | |
{% set result = (home_value - down_payment) * ( (interest_rate / 12 / 100) * ( (1 + interest_rate / 12 / 100) ) ** (loan_term * 12) / ( ( ( 1 + (interest_rate / 12 / 100 ) ) ** ( loan_term * 12 ) ) - 1 )) %} | |
<div class="uk-section uk-section-small uk-section-default uk-padding-remove-top"> | |
<h3>Payment Calculator</h3> | |
<div>$<span class="payment-calculator-result">{{ result|number_format(0) }}</span> per month</div> | |
<small>{{ loan_term }} Year Amortization with 5 Year Term, {{ interest_rate }}% Interest</small> | |
</div> |
This file contains hidden or 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 Cocoa | |
extension String { | |
func conformsTo(pattern: String) -> Bool { | |
let pattern = NSPredicate(format:"SELF MATCHES %@", pattern) | |
return pattern.evaluate(with: self) | |
} | |
} |
This file contains hidden or 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
composer () { | |
tty= | |
tty -s && tty=--tty | |
docker run \ | |
$tty \ | |
--interactive \ | |
--rm \ | |
--user $(id -u):$(id -g) \ | |
--volume /etc/passwd:/etc/passwd:ro \ | |
--volume /etc/group:/etc/group:ro \ |
This file contains hidden or 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 | |
namespace ABC; | |
use DI\NotFoundException; | |
use Phalcon\DI\FactoryDefault; | |
use Psr\Container\ContainerInterface; | |
class Container extends FactoryDefault implements ContainerInterface | |
{ |
This file contains hidden or 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
INSERT INTO test_table (service_id, event_type, creation_date) | |
SELECT | |
generate_series(7070001, 7070010) AS service_id, | |
('{clicked,pageview,failed}'::text[])[ceil(random()*3)] AS event_type, | |
timestamp '2016-01-10 20:00:00' + random() * (timestamp '2017-02-21 20:00:00' - timestamp '2016-01-10 10:00:00') AS creation_date | |
FROM generate_series(1, 10000000) AS X; |
NewerOlder