Skip to content

Instantly share code, notes, and snippets.

@iamso1
iamso1 / app.js
Created December 20, 2022 12:14
cors-proxy-test
const express = require('express');
const http = require('http');
const cors = require('cors');
// Configure & Run the http server
const app = express();
app.use(express.static(__dirname, { dotfiles: 'allow' }));
@iamso1
iamso1 / let's encrypt with docker-compose
Created October 15, 2022 13:08
init-letsencrypt.sh
#!/bin/bash
if ! [ -x "$(command -v docker-compose)" ]; then
echo 'Error: docker-compose is not installed.' >&2
exit 1
fi
domains=(example.org www.example.org)
rsa_key_size=4096
data_path="./data/certbot"
@iamso1
iamso1 / nginx.config
Last active November 22, 2020 06:12
nginx default config
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
const getFormattedTime = (dateObj) => {
const year = dateObj.getFullYear();
const month = dateObj.getMonth().toString().padStart(2, 0);
const date = dateObj.getDate().toString().padStart(2, 0);
const hour = dateObj.getHours().toString().padStart(2, 0);
const min = dateObj.getMinutes().toString().padStart(2, 0);
const sec = dateObj.getSeconds().toString().padStart(2, 0);
const result = `${year}-${month}-${date}T${hour}:${min}:${sec}`;
return result;
};
import Select from '../src/component/Select';
function onChange(value) {
console.log(`selected`, value);
}
function onBlur() {
console.log('blur');
}
@iamso1
iamso1 / scrollTable.js
Last active September 25, 2020 09:56
antdesign edit table with hook
import React, { useContext, useState, useEffect, useRef } from 'react';
import { Table, Input, Button, Popconfirm, Form } from 'antd';
const myData = {
myData: [
{
key: '1',
name: 'John Brown',
a: '1',
b: '2',
c: '3',
@iamso1
iamso1 / sample.js
Created September 21, 2020 09:39
react example
import React, { useContext, useState, useEffect, useRef } from 'react';
import { Table, Input, Button, Popconfirm, Form } from 'antd';
const EditableContext = React.createContext();
const EditableRow = ({ index, ...props }) => {
const [form] = Form.useForm();
return (
<Form form={form} component={false}>
<EditableContext.Provider value={form}>
@iamso1
iamso1 / test
Created March 17, 2020 17:40
test
var container = document.querySelector('#root > div > div.tw-flex.tw-full-height.tw-full-width > div > div > section > div > div.chat-list.tw-flex.tw-flex-column.tw-flex-grow-1.tw-flex-nowrap.tw-overflow-hidden > div.chat-list__lines.tw-flex-grow-1.scrollable-area > div.simplebar-scroll-content > div');
var observer = new MutationObserver(function() {
const content=document.querySelector('.simplebar-content > div> div:nth-last-child(2)').textContent;
if(content.indexOf('來抽便便')>1)
document.querySelector('#root > div > div.tw-flex.tw-full-height.tw-full-width > div > div > section > div > div.chat-input.tw-block.tw-pd-b-1.tw-pd-x-1 > div:nth-child(2) > div.tw-block.tw-relative.tw-z-default > div > div:nth-child(2) > div > div > textarea').value='!join'
document.querySelectorAll('.tw-mg-l-05')[1].querySelector('button').click();
});
observer.observe(container, {subtree: true, childList: true});
@iamso1
iamso1 / hideKKAD.js
Last active December 2, 2018 15:52
關閉kk的廣告
//step1:複製下面這段
document.querySelector('.public-activity').style.display='none'
//step2: 網頁案f12 選擇console
//step3: 把剛剛複製的指令貼上 並且按enter
//step4: 完成
@iamso1
iamso1 / DockerFile
Created October 11, 2018 08:07
dockerfile practice
FROM node:lastest
COPY ./release /app
WORKDIR /app
ENTRYPOINT node app.js