Skip to content

Instantly share code, notes, and snippets.

View XiXiongMaoXiong's full-sized avatar

雪人 XiXiongMaoXiong

View GitHub Profile
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active May 6, 2024 13:21
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

@Nachtalb
Nachtalb / telegram-desktop-multiple-accounts.rst
Last active March 22, 2024 06:08
Add multiple accounts in Telegram Desktop [Linux | MacOSX | Windows]
@oldmud0
oldmud0 / client.js
Created July 8, 2018 04:08
node-ipc example with high client->server reliability (no dropped messages)
const ipc = require("node-ipc");
const async = require("async");
const queue = async.queue((data, cb) => {
// There is no way of checking if client is connected so just
// catch and put it back in the queue if a bad happens.
try {
ipc.of.test.emit("message", data);
} catch (err) {
console.error(err);
@PrashamTrivedi
PrashamTrivedi / DownloadRequest.kt
Last active February 25, 2023 12:43
Download File with progress indicator, written in Kotlin with Co-routines
suspend fun downloadFile(url: String,
downloadFile: File,
downloadProgressFun: (bytesRead: Long, contentLength: Long, isDone: Boolean) -> Unit) {
async(CommonPool) {
val request = with(Request.Builder()) {
url(url)
}.build()
val client = with(OkHttpClient.Builder()) {
addNetworkInterceptor { chain ->
@nrollr
nrollr / nginx.conf
Last active April 22, 2024 15:11
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@mbrzusto
mbrzusto / fix_bad_quote_json.py
Created November 9, 2015 20:21
convert single quote json data file to double quote json data file (without mangling inner quotes)
__author__ = 'mbrzustowicz'
# metadata.json has single quotes like this
# {'asin': 'B00M0AEPXG', 'imUrl': 'http://ecx.images-amazon.com/images/I/51hcXTUeHLL._BO2,204,203,200_ ..... }
# so the strategy is to read each line as a string, and dump into a REAL json file
import json
import ast
fr=open("/Users/mbrzustowicz/Downloads/metadata.json")
@everdimension
everdimension / formdata.appenObject.js
Created October 26, 2015 18:01
Append nested object to FormData. The object can be just one level deep. For anything more complex it is recommended to rethink the way you send such data to the server.
(function() {
'use strict';
if (window.FormData) {
FormData.prototype.appendObject = function (obj, namespace) {
// EXAMPLE:
// var person = { name: 'some name', age: 87 };
// var fd = new FormData();
// fd.appenObject(obj, 'person');
@pinceladasdaweb
pinceladasdaweb / gist:6662290
Created September 22, 2013 18:04
Get Youtube Video Thumbnail with JavaScript.
var Youtube = (function () {
'use strict';
var video, results;
var getThumb = function (url, size) {
if (url === null) {
return '';
}
size = (size === null) ? 'big' : size;
@tbrianjones
tbrianjones / free_email_provider_domains.txt
Last active May 4, 2024 17:03
A list of free email provider domains. Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
126.com
150ml.com
15meg4free.com