Skip to content

Instantly share code, notes, and snippets.

View YouYue123's full-sized avatar
🎯
Focusing

YouYue YouYue123

🎯
Focusing
View GitHub Profile
@YouYue123
YouYue123 / KongJwt.md
Created December 17, 2020 07:03 — forked from martinheld/KongJwt.md
Short example to use JWT with Kong

JWT Kong Example

  • Get and Start Kong and Co
git clone git@github.com:Mashape/docker-kong.git
cd docker-kong/compose
docker-compose up
  • Create Kong API Route
# Creating and Storing password
- Take the user password
- Generate a salt(String of random characters)
- Combine the salt with the user entered password
- Hash the combined string with a suitable cryptographic algorithm.
@YouYue123
YouYue123 / drive-format-ubuntu.md
Last active August 15, 2018 09:16 — forked from keithmorris/drive-format-ubuntu.md
Partition, format, and mount a drive on Ubuntu
@YouYue123
YouYue123 / runDisabledTests.sh
Created February 13, 2018 14:52
Google test run disabled tests
./testAirAlignment --gtest_filter=PLSTests.* --gtest_also_run_disabled_tests
@YouYue123
YouYue123 / Password protection
Created June 16, 2017 03:28
WWW-Authenticate
app.use(basicAuth({
users: { 'someuser': 'somepassword' },
challenge: true,
realm: 'Imb4T3st4pp'
}))
@YouYue123
YouYue123 / generatorSample.js
Created February 20, 2017 08:54
Generator for NodeJS
const request = require('request')
var requests = []
for(let i=0;i<100;i++){
requests.push(i)
}
function* getAPI() {
for(let i=0; i<requests.length; i++){
yield sendAPI(i)
@YouYue123
YouYue123 / sync.py
Last active January 12, 2017 07:31
Python Script to sync between folders
import subprocess
import time
logFile = 'log.txt'
def timeLog(description):
currentTime = time.ctime()
subprocess.call("echo '%s Time %s' | cat >> %s" % (description,currentTime,logFile) ,shell=True)
def seperateLineLog():
import subprocess
with open('./a.txt') as f:
lines = f.readlines()
subprocess.call("db2 connect to campp4 user db2inst1 using pass123",shell=True)
for i in range(len(lines)):
item = lines[i]
item = item[:-1]
command = "db2 grant select on %s to role readonly" % item
print(command)
subprocess.call([command],shell=True)
@YouYue123
YouYue123 / Meteor Principle
Created August 18, 2016 03:03
Meteor Principle
SEVEN PRINCIPLES OF METEOR
Data on the Wire. Don't send HTML over the network. Send data and let the client decide how to render it.
One Language. Write both the client and the server parts of your interface in JavaScript.
Database Everywhere. Use the same transparent API to access your database from the client or the server.
Latency Compensation. On the client, use prefetching and model simulation to make it look like you have a zero-latency connection to the database.
@YouYue123
YouYue123 / Cancel Notification
Created August 9, 2016 06:45
Cancel Notification
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 3, repeats: false)
let identifier = "com.onevcat.usernotification.notificationWillBeRemovedAfterDisplayed"
let request = UNNotificationRequest(identifier: identifier, content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request) { error in
if error != nil {
print("Notification request added: \(identifier)")
}
}