Skip to content

Instantly share code, notes, and snippets.

@eliangcs
eliangcs / gist:1341253
Created November 5, 2011 07:57
Creating a Triangle Mesh with 3ds Max SDK
TriObject *createTriangleMesh(const std::vector<Point3> &points,
const std::vector<Point3> &normals,
const std::vector<Point2> &uvs,
const std::vector<int> &triangleVertIndices)
{
TriObject *triobj = CreateNewTriObject();
if (triobj == NULL)
return NULL;
assert(points.size() == normals.size() && normals.size() == uvs.size());
@eliangcs
eliangcs / secure-django-admin.rst
Last active June 8, 2021 16:10
Secure Django admin with self-signed SSL client certificate in Nginx.
@eliangcs
eliangcs / gist:6682975
Created September 24, 2013 10:32
phpmyadmin on Nginx
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
// Sublime Text
{
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"font_face": "DejaVu Sans Mono",
"font_size": 10,
"ignored_packages":
[
"Vintage"
],
"translate_tabs_to_spaces": true,
@eliangcs
eliangcs / ssh-config
Created April 10, 2014 02:12
Auto select SSH key
# ~/.ssh/config
Host *.compute-1.amazonaws.com
IdentityFile ~/.ssh/us-east-1.pem
Host *.ap-northeast-1.compute.amazonaws.com
IdentityFile ~/.ssh/ap-northeast-1.pem
@eliangcs
eliangcs / postgres9.3-install.sh
Last active May 28, 2018 11:33
Install PostgreSQL 9.3 on Ubuntu 12.04 LTS
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
# sudo apt-get install postgresql-9.3
# sudo apt-get install postgresql-client-9.3
@eliangcs
eliangcs / install_scrapy_dep.sh
Last active August 29, 2015 14:01
Scrapy dependencies on Ubuntu
sudo apt-get install -y gcc python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev build-essential
@eliangcs
eliangcs / sleekxmpp_client.py
Created May 13, 2014 04:08
Sleekxmpp example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
@eliangcs
eliangcs / linode-security.md
Last active January 11, 2022 23:09
Basic security setup for a brand new Linode

Basic Security Setup for a Brand New Linode

Why

When you start a clean Linode, it isn't secured in the following aspects:

  • Allows root SSH login
  • Uses password authentication on SSH
  • Doesn't have a firewall
@eliangcs
eliangcs / pyenv+virtualenv.md
Last active June 8, 2023 07:46
Cheatsheet: pyenv, virtualenvwrapper, and pip

Cheatsheet: pyenv, virtualenvwrapper, and pip

Installation (for Mac OS)

Install pyenv with brew

brew update
brew install pyenv