Skip to content

Instantly share code, notes, and snippets.

Frank Dai soulmachine

Block or report user

Report or block soulmachine

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
@soulmachine
soulmachine / LearningRateBatchScheduler.py
Created May 6, 2019
LearningRateBatchScheduler copied from experimental/resnet50_keras/resnet50.py
View LearningRateBatchScheduler.py
# Copied from https://github.com/tensorflow/tpu/blob/master/models/experimental/resnet50_keras/resnet50.py#L117
from absl import logging
from tensorflow.keras import backend as K
BASE_LEARNING_RATE = 0.4
# Learning rate schedule
LR_SCHEDULE = [ # (multiplier, epoch to start) tuples
(1.0, 5), (0.1, 30), (0.01, 60), (0.001, 80)
@soulmachine
soulmachine / _install.sh
Created Jun 25, 2018 — forked from marklit/_install.sh
Find the cheapest availability zone across all regions for an EC2 spot instance type
View _install.sh
pip install sh
View press.one
{"sig":"3f031dfe09afeaaefd498c2f625e1b378b8fdf789af7c65e475bb5c5cdb857787af439cca7a1d0f4ff4daf77c583fdb5394b07955b6a4e9f4ec666793a7d825c1","msghash":"6a83f85fc481f8a2d48e421b83bbdee911a73d067fbe8d1af65ee18b9dd4cd27"}
View BleedingInk.java
package me.soulmachine;
import java.util.*;
public class BleedingInk {
class State {
int x;
int y;
int parentDarkness;
@soulmachine
soulmachine / openssl-aes-encrypt.sh
Created Dec 12, 2017
openssl aes encrypt command line
View openssl-aes-encrypt.sh
# encrypt file.txt to file.enc using 256-bit AES in CBC mode
openssl enc -e -aes-256-cbc -salt -in file.txt -out file.enc
# the same, only the output is base64 encoded for, e.g., e-mail
openssl enc -e -aes-256-cbc -a -salt -in file.txt -out file.enc
# decrypt binary file.enc
openssl enc -d -aes-256-cbc -in file.enc -out file.txt
# decrypt base64-encoded version
@soulmachine
soulmachine / manual-uninstall-paragon-ntfs.sh
Created Dec 12, 2017 — forked from guycalledseven/manual-uninstall-paragon-ntfs.sh
Manually remove Paragon NTFS v15 leftovers MacOS
View manual-uninstall-paragon-ntfs.sh
# Just delete .config and .support in folder "/Library/Application Support/Paragon Software/"
# then you will get an another 10 days trial.
# after appcleaner does his magic, do this
sudo rm -rf "/Library/Application Support/Paragon Software/"
sudo rm /Library/LaunchDaemons/com.paragon-software.installer.plist
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfs.loader.plist
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfsd.plist
sudo rm /Library/LaunchAgents/com.paragon-software.ntfs.notification-agent.plist
@soulmachine
soulmachine / jwt-expiration.md
Last active Oct 15, 2019
How to deal with JWT expiration?
View jwt-expiration.md

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

View gist:752fb4ebfd2c9b6d6470928cb194855f
You can’t perform that action at this time.