Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

John Pham hprobotic

🌴
On vacation
Block or report user

Report or block hprobotic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View charge.py
try:
# Use both stripe_card or intent_payment_method is workable to charge
stripe_payment_method = payment_method.intent_payment_method or payment_method.stripe_card
idempotency_key = random_string_generator(20)
token = stripe.Token.create(
customer=current_user.stripe_customer,
stripe_account=connected_stripe_account_id
)
customer = stripe.Customer.create(
description='Shared Customer: {} {}'.format(current_user.first_name, current_user.last_name),
View charge.py
def create_stripe_payment(recipient_type, payment_method, scheduled_transaction, current_user, total_charge):
connected_stripe_account_id = get_stripe_account_id(
recipient_type,
payment_method.brand,
scheduled_transaction.source_currency)
paymentIntent = None
# Old method => Need to do migrate
dest_charge = None
try:
pay_source = stripe.Source.create(
@hprobotic
hprobotic / clean_my_mac_x_guide.md
Last active Jul 17, 2019
CleanMyMac X tutorial
View clean_my_mac_x_guide.md
  • 1. Install the trial from https://macpaw.com/cleanmymac
  • 2. Open CleanMyMac then click Action then Authenticate
  • 3. Install the CleanMyMac installer from here, click replace 
  • 4. I didn’t try to open the app. 
  • 5. Run: sudo xattr -r -d com.apple.quarantine /Applications/CleanMyMac\ X.app
  • 6. Run codesign -f -s – –deep /Applications/CleanMyMac\ X.app/ (Check note)
  • 7. Open CleanMyMac

Notes:

View upload_file.py
import boto3
# other libs import
s3 = boto3.client(
's3',
aws_access_key_id=AWS_ACCESS_KEY,
aws_secret_access_key=AWS_SECRET_KEY,
region_name=AWS_REGION_NAME
)
View KRW-API.json
[
{
"fields": [
{
"group": [
{
"refreshRequirementsOnChange": false,
"validationRegexp": null,
"name": "Recipient type",
"validationAsync": null,
View us.json
{
"status": "success",
"data": [
{
"example": "",
"type": "select",
"key": "legalType",
"displayFormat": null,
"minLength": null,
"maxLength": null,
@hprobotic
hprobotic / result.md
Last active Dec 20, 2018
Transferwise debug
View result.md

Outdated cuz we use personal account id

Get quote

{
   "id":1526617,
   "source":"HKD",
   "target":"SGD",
   "sourceAmount":5925.25,
   "targetAmount":1000.0,
@hprobotic
hprobotic / doc.md
Created Nov 26, 2018
Bug fix with flask, mysql and tox
View doc.md
  • Fix mysqlclient:
  • Check brew info openssl
View gist:a1edef65e7a969cb84815dad5fa1e44d
Givens a data.json file with structure bellow:
// data.json
[
{
"name": "Electronics",
"items": ["Phone", "Keyboards"]
},
{
"name": "Keyboards",
View random_guess.js
var x = Math.floor(Math.random() * 9) + 1;
var turns = 0;
var hint = 'Guess my number, 1-10!';
while (turns < 10) {
var guess = prompt(hint);
if (!guess) break;
guess = Number(guess);
if (guess == x) {
alert("Congratulations, you are a mind reader!");
You can’t perform that action at this time.