This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ENV from '@api/env'; | |
import { getUserFromAsyncStorage } from '@api/helpers'; | |
import { dateToYMDHMS } from '@common/date'; | |
type LoggerParams = { | |
input?: boolean; | |
output?: boolean; | |
hideKeys?: string[]; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- sua (set updated at): set updated_at = now() when updating row | |
create or replace function sua() returns trigger language plpgsql as $$ | |
begin | |
new.updated_at = now()::timestamptz(0); | |
return new; | |
end; $$; | |
-- asu (array sort unique): keep array values sorted and unique | |
create or replace function asu (anyarray) returns anyarray language sql as $$ | |
select array(select distinct $1[s.i] from generate_series(array_lower($1,1), array_upper($1,1)) as s(i) order by 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Start testnet and deploy application smart contract: | |
```sh | |
pnpm -F bcm hh:node | |
pnpm -F bcm hh:deploy --network localhost | |
``` | |
Hardhat JSON RPC is served at <http://127.0.0.1:8545>. | |
```json | |
{ | |
"name": "bcm", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:20.6-alpine as build | |
ARG NODE_ENV | |
ENV NODE_ENV=$NODE_ENV | |
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 | |
COPY ./ /opt | |
WORKDIR /opt | |
RUN apk --no-cache --update --upgrade add npm dumb-init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PassThrough } from 'stream'; | |
import { ChildProcessWithoutNullStreams, spawn } from 'child_process'; | |
// process spawned executing crawler to fetch subalterns | |
let subalterns_task: ChildProcessWithoutNullStreams | undefined; | |
router.all('/api/subalterns/stop', (ctx: Context) => { | |
if (!subalterns_task) { | |
ctx.body = 'Task is not running.'; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find /var/log/ -maxdepth 1 -type f -iwholename '*[^a-z0-9\-\_\.\/]*' -print0 | xargs -r -0 rm | |
find /var/log/ -maxdepth 1 -type f -not -iname '*_*' -print0 | xargs -r -0 rm | |
find /var/log/ -maxdepth 1 -type f -not -name '*_*.log*' -delete | |
find /var/log/ -maxdepth 1 -type f -name '*.php*' -delete | |
find /var/log/ -maxdepth 1 -type f -name '*.html*' -delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get update -y | |
apt-get upgrade -y | |
apt dist-upgrade -y | |
apt autoremove --purge -y | |
apt clean | |
do-release-upgrade | |
# clean logs folder | |
find /var/log -type f -delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.paypal.Buttons({ | |
// reference: https://developer.paypal.com/docs/checkout/integration-features/customize-button/ | |
style: { | |
layout: 'horizontal', | |
shape: 'rect', | |
color: 'blue', | |
fundingicons: false, | |
tagline: false, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove LANG warning on ssh connection | |
printf "LANG=en_US.utf-8\nLC_ALL=en_US.utf-8" > /etc/environment | |
# if you have strong reasons disable selinux... | |
printf "SELINUX=disabled" > /etc/selinux/config | |
# update system | |
yum upgrade -y | |
yum clean all | |
yum makecache timer |