sudo echo "127.0.0.1 yourhostname.dev" >> /etc/hosts
brew install nginx
brew services start nginx
export CERT_NAME=yourhostname.dev
export SSL_FOLDER=/etc/ssl
export NGINX=/opt/homebrew/etc/nginx
chmod +x ./generate_certificate.sh
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
{ | |
"ResponseCode": "05", | |
"TransactionID": "YTDZYW", | |
"TransactionId": "YTDZYW", | |
"RemoteResponseCode": "N/A", | |
"AuthorizationCode": "N/A", | |
"RetrivalReferenceNumber": "000000000001", | |
"CreditCardNumber": "493198______6702", | |
"TxToken": "txn-4b6e9ad69e5b4e8d996d244a0af14986", | |
"ResponseDetails": "transaction_rejected" |
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
from myapp.settings.base import API_BASE_URL, PAYMENTS_MERCHANT_NAME, PAYMENTS_MERCHANT_NUMBER, PAYMENTS_MERCHANT_TERMINAL, PAYMENTS_MCC | |
from myapp_payments.models import Transaction | |
from django.utils.translation import gettext as _ | |
class CardNetPaymentIntegrationService: | |
def get_message_from_status_code(status_code): | |
match status_code: | |
case "success": |
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/sh | |
DROPLET_IP= | |
DROPLET_GATEWAY= | |
ip link set eth0 up | |
ip link set eth1 up | |
ip addr flush dev eth0 | |
ip addr add $DROPLET_IP/32 dev eth0 | |
ip route add $DROPLET_GATEWAY dev eth0 |
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 { useCallback, useEffect, useState } from "react"; | |
type Status = "idle" | "loading" | "error" | "fetched" | "debouncing"; | |
export type Options = { | |
timeout?: number; | |
debounceTime?: number; | |
}; | |
export type FetchAttempt<T> = Partial<RequestInit> & { |
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
# pip3 uninstall pycrypto | |
# pip3 install pycryptodome | |
from Crypto.Cipher import AES | |
import base64 | |
BLOCK_SIZE = 16 | |
def pad(data): |
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 fs from 'fs' | |
import path from 'path' | |
function listJsFiles(dir) { | |
return fs.readdirSync(path.resolve('.', dir)).reduce((files, file) => { | |
let result = [...files] | |
const filePath = path.join(dir, file) | |
if (fs.lstatSync(filePath).isDirectory()) { | |
result = result.concat(listJsFiles(filePath)) | |
} |
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
/** | |
* Example data in the collection: | |
* | |
* [ | |
* { _id: ObjectId(), key: "foo", value: "bar" }, | |
* { _id: ObjectId(), key: "fbKey", value: "123" }, | |
* { _id: ObjectId(), key: "logoUrl", value: "https://my-site.s3.aws.us-east-1/logo.png" }, | |
* ] | |
*/ |
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
# ... your zsh file | |
function _virtualenv_auto_activate() { | |
current_dir=$(pwd) | |
if [[ -d "./venv" && -z "$VIRTUAL_ENV" ]]; then | |
export VIRTUAL_ENV_PATH=$current_dir; | |
source $VIRTUAL_ENV_PATH/venv/bin/activate | |
elif [[ ! -z "$VIRTUAL_ENV" && $current_dir != "$VIRTUAL_ENV_PATH"* ]]; then | |
export VIRTUAL_ENV_PATH=; | |
deactivate |
NewerOlder