Skip to content

Instantly share code, notes, and snippets.

View EugeneLiang's full-sized avatar
🎯
Focusing

Eugene Liang EugeneLiang

🎯
Focusing
View GitHub Profile
@EugeneLiang
EugeneLiang / index.js
Created February 2, 2019 05:39 — forked from codediodeio/index.js
Integrate Twilio with Firebase Cloud Functions
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const twilio = require('twilio');
const accountSid = functions.config().twilio.sid
const authToken = functions.config().twilio.token
const client = new twilio(accountSid, authToken);
@EugeneLiang
EugeneLiang / ofo.php
Created December 31, 2017 12:02 — forked from 582033/ofo.php
ofo订单
<?php
class ofo {
public function __construct($carno, $coord_url, $token){
list($this->lat, $this->lng) = $this->get_coord($coord_url);
$this->carno = $carno;
$this->token = $token;
}
//把高德url转换为坐标
@EugeneLiang
EugeneLiang / gist:e0520472e2cf6970c57d9db8e259701b
Last active March 23, 2017 03:17
Thing to do for security (LB)

Assuming EC2 was hacked

Range of IP:61.20.0.0/16 This is a more serious situation, as the other machines on this VPC may be scanned and hence exposed.

Further assuming the hacker puts in a trojon horse, and LB refuses to pay up, the hacker might attack other machines since he has scanned for other machines.

How do we know if the above will happen? If your machines are using the same ssh public key to connect, there's a very good chance that other machines are also hacked.

Next, the production machines's port 22 is 0.0.0.0/0, this is EXTREMELY DANGEROUS.

@EugeneLiang
EugeneLiang / AWSLambdaSimpleSMS.js
Created June 18, 2016 08:59 — forked from stevebowman/AWSLambdaSimpleSMS.js
AWS Lambda Function to send an SMS message via the Twilio API
console.log('Loading event');
// Twilio Credentials
var accountSid = '';
var authToken = '';
var fromNumber = '';
var https = require('https');
var queryString = require('querystring');
@EugeneLiang
EugeneLiang / angular-phonegap-seed.md
Created September 26, 2015 12:23 — forked from nackjicholson/angular-phonegap-seed.md
AngularJS, Phonegap, and Angular Seed. Let's Go!

I have been wanting to learn how to write a mobile app with Phonegap for, well...since I first heard there was such an incredible thing as Phonegap. The very idea that it could make a Objective-C ignorant (but js ambitious) developer like myself, able to take his satisfactory JS/HTML/CSS code and transform it into a satisfactory mobile experience. Yay, Phonegap. But, you probably aren't here because you don't know what Phonegap is, you're probably here because you want to put the oh-so-interesting angularjs framework onto a phone and do incredible things. Well, so did I. I found great tutorials, the best of which is definitely this 4-part delight by [@markcoleman][1].

[Phonegap and Angularjs the Start][2]

I would've been lost without it. However, after I completed it I wanted to build my own app, and I was looking for a place to start. In my exploratory phase with angular, I had discovered the [angular-seed][3] project and [angular-phonecat][4] tutorial. I knew angular-seed would start me out with runnable

var base_path = __dirname.replace('resources/nodejs', '');
require('dotenv').config({
path: base_path+'.env'
});
var port = process.env.NODE_SERVER_PORT,
redis = require('redis'),
redis_client = redis.createClient(),
cookie = require('cookie'),
os = require('os'),
<?php
/**
* QR Code + Logo Generator
*
* http://labs.nticompassinc.com
*/
$data = isset($_GET['data']) ? $_GET['data'] : 'http://labs.nticompassinc.com';
$size = isset($_GET['size']) ? $_GET['size'] : '200x200';
$logo = isset($_GET['logo']) ? $_GET['logo'] : FALSE;
<?php
echo "Hello World";
?>

This is a post by Joel Spolsky. The original post is linked at the bottom.

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju

// Installation
// 1. Install Node.js http://nodejs.org/download/
// 2. In Terminal, cd (navigate) to the directory where you saved this file
// 3. Run 'npm install request', let it install, then run 'npm install async'.
// 4. Edit the script config below with your token, org, app, and collection name.
// 5. To run the script, at the Terminal prompt, run 'node api_baas_deleter.js'
// Note: some minor updates were made to this file because.sillypeople