Skip to content

Instantly share code, notes, and snippets.

@chj1768
chj1768 / simple_rsa
Last active December 16, 2022 07:20
RSA encryption / decryption example (nodejs)
openssl key pair generate
//client - using meteor.js
const nodersa = Npm.require('node-rsa');
import { HTTP } from 'meteor/http';
const syncPost = Meteor.wrapAsync( HTTP.post, HTTP );
encryptStringWithRsaPublicKey( data ) {
const absolutePath = Assets.absoluteFilePath( "public.key" ); //public key file path
const publicKey = fs.readFileSync( absolutePath, "utf8" );
@AlexanderBaggett
AlexanderBaggett / RedIDE.red
Last active October 16, 2019 14:07
Red IDE
Red [needs 'view]
;;keywords: to-block read %keywords.txt this puts the words on different lines
;;keywords: to-block form read/lines %keywords.txt
functions: read %functions.txt
natives: read %natives.txt
types: read %datatypes.txt
events: read %events.txt
;; could also do read/lines %keywords.txt and put each word on it's own line in the file itself.
@kritollm
kritollm / bulmatoscss_gulpfile.js
Last active December 25, 2018 13:04
Converts Bulma CSS framework from SASS to SCSS
// Bulma to scss gulp script
// In your terminal
// 1. npm install -D sass-convert gulp bulma gulp-sass gulp-replace
// 2. gem install sass
var gulp = require("gulp"),
replace = require('gulp-replace'),
converter = require('sass-convert'),
sass = require('gulp-sass');
@lmcneel
lmcneel / remove-node-modules.md
Last active April 18, 2025 19:05
How to remove node_modules after they have been added to a repo

How to remove node_modules

Create a .gitignore file

  1. Check for an existing .gitignore file in the project directory
ls -a
<html>
<head>
<title>API Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var accessToken = "<your agent's client access token>";
var baseUrl = "https://api.api.ai/v1/";
@todditron
todditron / Git post-receive hook for webfaction
Last active October 10, 2019 21:02 — forked from negatronGister/Git post-receive hook for webfaction
Git post-receive hook for deploying on webfaction
# *** INSTRUCTIONS ********
# $ cd repo.git/hooks
# $ vi post-receive
# paste this and fix formatting since things always get funky pasting into VI
# ESC
# :wq
# $ chmod +x post-receive
# ***************************
#!/bin/sh
@hamzamu
hamzamu / d3-server.js
Created October 26, 2016 13:16 — forked from caged/d3-server.js
Directly render and serve d3 visualizations from a nodejs server.
// Start `node d3-server.js`
// Then visit http://localhost:1337/
//
var d3 = require('d3'),
http = require('http')
http.createServer(function (req, res) {
// Chrome automatically sends a requests for favicons
// Looks like https://code.google.com/p/chromium/issues/detail?id=39402 isn't
// fixed or this is a regression.
@yosukehasumi
yosukehasumi / git-auto-deploy.md
Last active July 25, 2023 20:07
Setting Up Git-Auto-Deploy on Digital Ocean

Install software-properties-common

sudo apt-get install software-properties-common

Add Repo

sudo add-apt-repository ppa:olipo186/git-auto-deploy
<html>
<head>
<title>API Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var accessToken = "<your agent's client access token>";
var baseUrl = "https://api.api.ai/v1/";

#MongoDB 3.2.x Replica Sets on AWS EC2 A MongoDB replica set provides a mechanism to allow for a reliable database services. The basic replica set consists of three servers, a primary, a secondary and an arbitrator. The primary and secondary both hold a copy of the data. The arbitrator is normally a low spec server which just monitors the other servers and help with the failover process. In production, there can be more than three servers.

To setup mongo as a replica set on Amazon Web Services EC2 you need to first setup a security group with ssh on port 22 and mongodb on port 27017. You then need to create three servers. Select Ubuntu 14.04 LTS x64 and a micro (or bigger depending on your database size, ideally you should have enough memory to match your database size) instance for the primary and secondary and a nano instance for the arbitrator.

##Adjust the File System on each Server The operating system by default will update the last access time on a file. In a high data throughput database application