Skip to content

Instantly share code, notes, and snippets.

View junzhengca's full-sized avatar
🥼
ummm.... weird....

Jun junzhengca

🥼
ummm.... weird....
View GitHub Profile
@junzhengca
junzhengca / commands.txt
Created February 12, 2018 20:11
如何在 AWS (或者其他提供商)创建 LAMP 环境
sudo apt-get update
sudo apt-get install apache2
sudo apache2ctl configtest
sudo nano /etc/apache2/apache2.conf
sudo systemctl restart apache2
sudo ufw allow in "Apache Full"
sudo apt-get install mysql-server
mysql_secure_installation
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
sudo systemctl restart apache2
@junzhengca
junzhengca / mongodb-org-3.6.repo
Created December 5, 2017 17:35
MongoDB 3.6 Install Scripts
[mongodb-org-3.6]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
@junzhengca
junzhengca / sample-with-mail.key
Last active September 5, 2017 21:13
Check if SSH public key is valid. Optional email address.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8P5EVps2YEfo0XiW4NP/+AIUpjvio2l1D+PlhTb4VNddqg/ykjDWWBT9JgxQ5cK0sytY0OqTaA15fzFMIgNBV1ypWIXkwx2eLfapzzAA/nAgJnv53zIGuflhkKwshu19uSIcIT5j8jfxlDQq8anUMnmcw1K/Scg35PJhSQgKpmo4/Wz5yWL+00Gsr7odlNvjRgKj78P7JEDO1j20HE0avxT4Krrwc4GAJq0f8CgEulNJXO0BVK1MidbT68u9xfCe4GFj7JakUoqnHEWC4ATIo9FdB3XpCRTLTwoTAAj34AmhpSa/F788Bg/AB+wZA2+HtME0G+Jc2igTXIWVgKHgF junthehacker@MacBook-Pro.local
@junzhengca
junzhengca / ssh-key-check.js
Created September 5, 2017 21:11
Check if SSH public key is valid. Optional email address.
var isValidSSHKey = function(key){
return /^ssh-rsa AAAA[0-9A-Za-z+\/]+[=]{0,3}( [^@]+@[^@]+)?$/.test(key);
}
@junzhengca
junzhengca / README.md
Last active September 1, 2017 20:37
Simple bash script to add Apache 2 VirtualHost & modify /etc/hosts

How to use

Simply download this script, change VHOST_FILE to the file your apache server is using for vhosts.

Run

sudo ./add_local_virtualhost.sh <dir path> <domain>

For example

@junzhengca
junzhengca / md5.js
Created April 26, 2017 06:58
md5 in javascript
var PouchUtils = {};
PouchUtils.Crypto = {};
(function () {
PouchUtils.Crypto.MD5 = function (uint8Array) {
function md5cycle(x, k) {
var a = x[0], b = x[1], c = x[2], d = x[3];
a = ff(a, b, c, d, k[0], 7, -680876936);
d = ff(d, a, b, c, k[1], 12, -389564586);
c = ff(c, d, a, b, k[2], 17, 606105819);
@junzhengca
junzhengca / md5.js
Created April 26, 2017 06:58
md5 in javascript
var PouchUtils = {};
PouchUtils.Crypto = {};
(function () {
PouchUtils.Crypto.MD5 = function (uint8Array) {
function md5cycle(x, k) {
var a = x[0], b = x[1], c = x[2], d = x[3];
a = ff(a, b, c, d, k[0], 7, -680876936);
d = ff(d, a, b, c, k[1], 12, -389564586);
c = ff(c, d, a, b, k[2], 17, 606105819);
class LinkedListNode:
def __init__(self, value):
self._value = value
self._next = None
def insert(root, value):
while root._next is not None:
root = root._next
root._next = LinkedListNode(value)
@junzhengca
junzhengca / bst.py
Created March 8, 2017 00:38
Binary Search Tree
class BinarySearchTree:
def __init__(self):
self._root = None
def insert(self, val):
if self._root is None:
self._root = Node(val)
else:
curr_node = self._root
while True:
@junzhengca
junzhengca / bst_node_removal.py
Created March 7, 2017 23:46
BST Node Removal
class BinarySearchTree:
def __init__(self):
self._root = None
def insert(self, val):
if self._root is None:
self._root = Node(val)
else:
curr_node = self._root
while True: