Skip to content

Instantly share code, notes, and snippets.

View wwwy3y3's full-sized avatar
🎯
Focusing

william chang(張仲威) wwwy3y3

🎯
Focusing
View GitHub Profile
@wwwy3y3
wwwy3y3 / ingress.yaml
Last active October 26, 2023 13:08
test
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx-public
nginx.ingress.kubernetes.io/proxy-body-size: "0"
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
nginx.ingress.kubernetes.io/rewrite-target: /$1
labels:
@wwwy3y3
wwwy3y3 / test.sql
Created October 25, 2023 09:55
oracle
SELECT
'U+' || TO_CHAR(TO_NUMBER(UNICODE(TO_NCHAR(REGEXP_SUBSTR(my_column, '.', 1, LEVEL)))), 'FMXXXX')
AS unicode_str
FROM my_table
CONNECT BY PRIOR dbms_random.value IS NOT NULL
AND PRIOR my_column = my_column
AND PRIOR sys_guid() IS NOT NULL
AND LEVEL <= LENGTH(my_column);
@wwwy3y3
wwwy3y3 / loader.js
Last active October 23, 2023 09:41
test.html
document.getElementById('fetchData').addEventListener('click', async function () {
const loader = document.getElementById('loader');
loader.style.display = 'block';
// Fetch data and update tables...
// After all fetches and updates
loader.style.display = 'none';
});
@wwwy3y3
wwwy3y3 / test.sql
Created October 23, 2023 05:55
test
SELECT
CASE
WHEN get_userinfo('username') = 'william' THEN appl_id
WHEN get_userinfo('username') = 'jimmy' THEN CONCAT(SUBSTRING(appl_id, 1, LENGTH(appl_id) - 6), 'XXXXXX')
ELSE appl_id
END AS appl_id
FROM ods_report
WHERE unit_code = (
SELECT
CASE
@wwwy3y3
wwwy3y3 / permission.json
Last active July 23, 2020 04:45
CannerFlow Deployment JSON
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CreateResource",
"Effect": "Allow",
"Action": [
"rds:CreateDBSubnetGroup",
"rds:CreateDBInstance",
"rds:DescribeDBInstances",
--log_gc (Log heap samples on garbage collection for the hp2ps tool.)
type: bool default: false
--expose_gc (expose gc extension)
type: bool default: false
--max_new_space_size (max size of the new generation (in kBytes))
type: int default: 0
--max_old_space_size (max size of the old generation (in Mbytes))
type: int default: 0
--max_executable_size (max size of executable memory (in Mbytes))
type: int default: 0
@wwwy3y3
wwwy3y3 / dnsmasq OS X.md
Created September 13, 2016 15:28 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

Install

@wwwy3y3
wwwy3y3 / how-to-set-up-stress-free-ssl-on-os-x.md
Created March 23, 2016 14:30 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

var mongoose = require('./db-connect'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId,
uuid = require('node-uuid'),
Validator = require('validator').Validator,
val = new Validator(),
bcrypt = require('bcrypt');
Validator.prototype.error = function(msg) { return false; };