Skip to content

Instantly share code, notes, and snippets.

View notcod's full-sized avatar
💭
I may be slow to respond.

notcod

💭
I may be slow to respond.
View GitHub Profile
const puppeteer = require('puppeteer');
const nodemailer = require('nodemailer');
class Webpage {
static async generatePDF(url) {
const browser = await puppeteer.launch({ headless: true }); // Puppeteer can only generate pdf in headless mode.
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle', networkIdleTimeout: 5000 }); // Adjust network idle as required.
const pdfConfig = {
format: 'A4',
@notcod
notcod / gist:79219f7339c7197bbe77ddc715f8bca2
Created August 6, 2023 11:05 — forked from stereokai/gist:36dc0095b9d24ce93b045e2ddc60d7a0
CSS rounded corners with gradient border
.rounded-corners-gradient-borders {
width: 300px;
height: 80px;
border: double 4px transparent;
border-radius: 80px;
background-image: linear-gradient(white, white), radial-gradient(circle at top left, #f00,#3020ff);
background-origin: border-box;
background-clip: padding-box, border-box;
}
<?php
<?php
///amo integra begin
$values = $hook->getValues();
$subject = $modx->getOption('emailSubject', $formit->config, 'form-'.$modx->resource->get('emailSubject'));
$name = $values['name'];
$phone = $values['phone'];
$email = $values['email'];
@notcod
notcod / header_http_status_codes.php
Created February 17, 2023 18:48 — forked from phoenixg/header_http_status_codes.php
PHP header() for sending HTTP status codes
<?php
/*
参考自:
http://darklaunch.com/2010/09/01/http-status-codes-in-php-http-header-response-code-function
http://snipplr.com/view/68099/
*/
function HTTPStatus($num) {
$http = array(
@notcod
notcod / auto_git_file.md
Created December 30, 2022 22:08 — forked from darencard/auto_git_file.md
Automatic file git commit/push upon change

Please see the most up-to-date version of this protocol on my blog at https://darencard.net/blog/.

Automatically push an updated file whenever it is changed

Linux

  1. Make sure inotify-tools is installed (https://github.com/rvoicilas/inotify-tools)
  2. Configure git as usual
  3. Clone the git repository of interest from github and, if necessary, add file you want to monitor
  4. Allow username/password to be cached so you aren't asked everytime
@notcod
notcod / ProofOfExistence.sol
Created September 17, 2021 21:36 — forked from ageyev/ProofOfExistence.sol
This smartcontract is used to store documents text on the Ethereum blockchain and to get the document by document's hash (sha256).
/*
This smartcontract is used to store documents text on the Ethereum blockchain
and to get the document by document's hash (sha256).
*/
contract ProofOfExistence{
/* ---- Public variables: */
string public created;
@notcod
notcod / getPubKey.py
Created July 21, 2021 02:15 — forked from CrackerHax/getPubKey.py
Python script for getting ethereum public key from transaction id
import web3
w3 = web3.Web3(web3.HTTPProvider('https://geth.golem.network:55555'))
tx = w3.eth.getTransaction('0x00ee93fd1e6fdbdf841b4458a078210449dce89525502c965fd3534ba397e2e3')
tx.hash
from eth_account._utils.signing import extract_chain_id, to_standard_v
s = w3.eth.account._keys.Signature(vrs=(
to_standard_v(extract_chain_id(tx.v)[1]),
w3.toInt(tx.r),
@notcod
notcod / node_nginx_ssl.md
Created February 28, 2021 04:25 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user