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
const https = require('https'); | |
const app = require('express')(); | |
const privatekey = fs.readFileSync('PRIV_FILE_PATH'); | |
const certificate = fs.readFileSync('CERT_FILE_PATH'); | |
const credentials = {key: privatekey, cert: certificate}; | |
const port = PORT_NUM; | |
https.createServer(credentials, app).listen(port, () => { | |
console.log(`http server start with ${port}`); |
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
class TtFTree { | |
constructor() { | |
this._children = [] | |
this._key = [] | |
} | |
insert(node, prenode, key) { | |
if(_key.length == 3) { | |
_middleUp(node, prenode) | |
} |
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
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <map> | |
#define MAX 20 | |
using namespace std; |
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
#!/bin/bash | |
ID="loginID" | |
PWD="Password" | |
URL="https://testurl.com" | |
COOKIE_FILE="cookies.txt" | |
LOG_FILE="login_log.html" | |
`(curl ${URL} \ | |
--data-urlencode "id=${ID}" \ | |
--data-urlencode "pwd=${PWD}" \ |
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
// This is from my comment here: http://wolfram.kriesing.de/blog/index.php/2008/javascript-remove-element-from-array/comment-page-2#comment-466561 | |
/* | |
* How to delete items from an Array in JavaScript, an exhaustive guide | |
*/ | |
// DON'T use the delete operator, it leaves a hole in the array: | |
var arr = [4, 5, 6]; | |
delete arr[1]; // arr now: [4, undefined, 6] |
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 socket | |
import subprocess | |
server_address = '/superpython' | |
if __name__ == '__main__': | |
# create socket | |
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | |
# Bind the socket to the port |
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 functools | |
import os | |
import re | |
import asyncio | |
from PIL import Image | |
def pixel_converter(bright): | |
if bright == 255: | |
val = ' ' |
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 smtplib | |
from email.mime.text import MIMEText | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.application import MIMEApplication | |
mail = MIMEMultipart() | |
mail['Subject'] = title | |
mail.preamble = 'This is a multi-part message in MIME format' | |
mail.attach(MIMEImage(message)) |
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 smtplib | |
from email.mime.text import MIMEText | |
from email.mime.image import MIMEImage | |
from email.mime.multipart import MIMEMultipart | |
mail = MIMEMultipart() | |
mail['Subject'] = 'this is title' | |
fp = open(file, 'rb') # only image works | |
mail.attach(MIMEImage(fp.read())) |
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 smtplib | |
from email.mime.text import MIMEText | |
sender = 'sender@example.com' #my domain | |
recipient = 'recipient@example.com' | |
mail = MIMEText('message goes here') | |
mail['Subject'] = 'title goes here' | |
mailserver = smtplib.SMTP('localhost') |
NewerOlder