Skip to content

Instantly share code, notes, and snippets.

View scriptmaster's full-sized avatar
💭
git commit -am “… ai generated comment here …”

ScriptMaster scriptmaster

💭
git commit -am “… ai generated comment here …”
View GitHub Profile
#!/bin/sh
echo "\n\n\n\n\n\n\n\n\nFree RAM before clearing page caches"
free -m
echo "\n\nIt is safe to clear page caches in production, but not dentries or inodes. For example: 1 is safe, 2 and 3 are not safe."
sync
echo "\nFlushed FS buffers, clearing page caches"
echo 1 > /proc/sys/vm/drop_caches
# https://facebook.github.io/react-native/docs/signed-apk-android.html
keytool -genkey -v -keystore bvreactstore.keystore -alias bvreact -keyalg RSA -keysize 2048 -validity 20000
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore bvreactstore.keystore bvreact-signed.apk bvreact
zipalign -v 4 bvreact-signed.apk bvreact.apk

Definitions for react-redux

Deps

install redux redux thunk and react redux

npm install redux redux-thunk react-redux

Imports

TypeScript node

Use TypeScript with node by installing typescript and @types/node

yarn global add typescript

In your project directory:

mkdir tsapp && cd tsapp

TypeScript + Webpack

You want to quick start typescript and webpack project (server or client), what are the steps to do?

Create a blank dir

Let's say an http server :-)

mkdir tshttp && cd tshttp

@scriptmaster
scriptmaster / nginx-nodejs-with-websocket.conf
Last active September 7, 2017 09:52
The most simple nginx site configuration for nodejs with websocket support
upstream teamchess3000 {
server 127.0.0.1:3000;
# server 127.0.0.1:4000; # Add another node
ip_hash;
}
server {
listen 80;
location / {
<style type="text/css">
/****** EMAIL CLIENT BUG FIXES - BEST NOT TO CHANGE THESE ********/
.ExternalClass {
width: 100%;
}
/* Forces Outlook.com to display emails at full width */
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; }
/* Forces Outlook.com to display normal line spacing, here is more on that: http://www.emailonacid.com/forum/viewthread/43/ */
<?php
require 'phpmailer/class.phpmailer.php';
if(empty($_POST['email']) || empty($_POST['title']) || empty($_POST['first_name']) || empty($_POST['last_name'])) return;
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
// $mail->SMTPDebug = 2;