Skip to content

Instantly share code, notes, and snippets.

View soulmachine's full-sized avatar

Frank Dai soulmachine

View GitHub Profile
@soulmachine
soulmachine / LearningRateBatchScheduler.py
Created May 6, 2019 01:26
LearningRateBatchScheduler copied from experimental/resnet50_keras/resnet50.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 June 25, 2018 05:34 — forked from marklit/_install.sh
Find the cheapest availability zone across all regions for an EC2 spot instance type
pip install sh
{"sig":"3f031dfe09afeaaefd498c2f625e1b378b8fdf789af7c65e475bb5c5cdb857787af439cca7a1d0f4ff4daf77c583fdb5394b07955b6a4e9f4ec666793a7d825c1","msghash":"6a83f85fc481f8a2d48e421b83bbdee911a73d067fbe8d1af65ee18b9dd4cd27"}
@soulmachine
soulmachine / BleedingInk.java
Last active January 22, 2018 05:54
Bleeding Ink
package me.soulmachine;
import java.util.*;
public class BleedingInk {
class State {
int x;
int y;
int parentDarkness;
@soulmachine
soulmachine / openssl-aes-encrypt.sh
Created December 12, 2017 19:49
openssl aes encrypt command line
# 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 December 12, 2017 15:00 — forked from guycalledseven/manual-uninstall-paragon-ntfs.sh
Manually remove Paragon NTFS v15 leftovers MacOS
# 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 April 9, 2024 04:12
How to deal with JWT expiration?

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:

@soulmachine
soulmachine / aircrack-ng-1.jpg
Last active October 30, 2017 07:07
aircrack-ng快速入门
aircrack-ng-1.jpg
@soulmachine
soulmachine / gist:752fb4ebfd2c9b6d6470928cb194855f
Created February 1, 2017 22:57 — forked from zythum/gist:2848881
google收录的敏感词