Skip to content

Instantly share code, notes, and snippets.

View dzcpy's full-sized avatar
🎯
Focusing

dzcpy

🎯
Focusing
View GitHub Profile
module.exports = {
get: function (req, res) {
res.sendfile(req.path.substr(1));
},
_config: {
rest: false,
shortcuts: false
}
};
var Promise = require('bluebird');
var request = Promise.promisifyAll(require('request'));
ENABLE_FIDDLER_PROXY = false;
var proxy = ENABLE_FIDDLER_PROXY ? {proxy: 'http://127.0.0.1:8888'} : {};
console.log('before all requests');
// Google and v2ex are parallel requests
// api/controllers/AuthController.js
var passport = require('passport');
var AuthController = {
login: function (req,res)
{
res.view();
},
/**
* Simple authentication and authorization example with passport, node_acl,
* MongoDB and expressjs
*
* The example shown here uses local userdata and sessions to remember a
* logged in user. Roles are persistent all the way and applied to user
* after logging in.
*
* Usage:
* 1. Start this as server
@dzcpy
dzcpy / gist:c76da5bbf437356ea64b
Last active October 7, 2015 08:22 — forked from devzendo/gist:3a474908b71b66ffa9d7
Getting started with Arduino Micro, 1602A LCD, I2C LCD backpack.
// Using https://arduino-info.wikispaces.com/LCD-Blue-I2C
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
void setup() {
lcd.begin(16, 2);
@dzcpy
dzcpy / mclarens.js
Created November 3, 2013 06:10 — forked from nikhilm/mclarens.js
/*
* Mclarens Bar: Redis based Instant Messaging
* Nikhil Marathe - 22/04/2010
* A simple example of an IM client implemented using
* Redis PUB/SUB commands so that all the communication
* is offloaded to Redis, and the node.js code only
* handles command interpretation,presentation and subscribing.
*
* Requires redis-node-client and a recent version of Redis

Visual C++ Build Tools 2015 (Pre-release). If you want to build your C++ projects targeting Windows desktop without having Visual Studio installed on your computer, Microsoft Visual C++ Build Tools 2015 provides the required tools: C++ compilers, libraries, build scripts, Windows SDKs. This Community Technology Preview ships with the same C++ compilers and libraries packaged with Visual Studio 2015 Update 1 RC (2015.1). http://blogs.msdn.com/b/vcblog/archive/2015/10/29/visual-studio-2015-update-1-rc-available.aspx The config steps with Node.js should now be as follows:

Install VC++ Build Tools Technical Preview

💡 [Windows 7 only] requires .NET Framework 4.5.1 Install Python 2.7, and add it to your PATH, npm config set python python2.7

Launch cmd, npm config set msvs_version 2015 --global (this is instead of npm install [package name] --msvs_version=2015 every time.)

@dzcpy
dzcpy / setup.sh
Last active July 30, 2018 09:00
Setup Raspberry Pi with Arch ARM
#!/bin/sh
sed -i 's/#en_US\.UTF-8 UTF-8/en_US\.UTF-8 UTF-8/g' /etc/locale.gen
locale-gen
sed -i '/gpu_mem=/s/=64$/=128/g' /boot/config.txt
echo 'dtparam=audio=on' >> /boot/config.txt
echo 'start_file=start_x.elf' >> /boot/config.txt
echo 'fixup_file=fixup_x.dat' >> /boot/config.txt
echo 'disable_camera_led=1' >> /boot/config.txt
echo 'bcm2835-v4l2' > /etc/modules-load.d/rpi-camera.conf
@dzcpy
dzcpy / arch-setup.sh
Last active June 27, 2021 01:59
Arch Linux setup
#!/bin/sh
pacman -Syu
pacman -S base-devel go nodejs npm npm-check-updates certbot certbot-nginx wget tree xz socat git zsh cronie
#enable en_US.UTF-8
#vim /etc/locale.gen
locale-gen
localectl set-locale LANG=en_US.UTF-8
#bbr
echo "net.core.default_qdisc=fq" >> /etc/sysctl.d/bbr.conf
FROM alpine:latest
WORKDIR /opt
EXPOSE 443/tcp 500/udp 4500/udp
ENV HOST_NAME=
ENV LOGIN_USER=
ENV LOGIN_PASSWORD=
ENV LOCAL_SUBNET=172.19.240.0/20