Skip to content

Instantly share code, notes, and snippets.

//Thanks to:
//http://www.benjiegillam.com/2012/06/node-dot-js-ssl-certificate-chain/
//For the code to pass a CA bundle (multiple certs in one file) as an array
//which fixes certificate errors on some browsers when doing https.createServer(options
//This is how you can fix that with nodejitsu's http-proxy when using SNI
// to have a server listening and returning multiple ssl certs
require "Subprocess"
require "tmpdir"
#
# Currently will only convert a single swift code file into a static library
# and cannot include any Objective-C code.
#
# Usage: generate("/path/to/MyCode.swift", :ios)
#
def generate(file, platform, dst=nil)
doctype html
html
head
title Title Site
meta(charset='UTF-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(name='description' content="meta desc")
meta(name='viewport' content='width=device-width, initial-scale=1.0')
link(rel="stylesheet", type="text/css", href="css/main.css")
@apache2046
apache2046 / gist:9cc611f91636712694e4
Created November 20, 2015 03:38
Mongoose populate an array
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;
mongoose.connect('mongodb://localhost/testy2');
var UserSchema = new Schema({
name: String
});
//
// SimpleScrollingStack.swift
// A super-simple demo of a scrolling UIStackView in iOS 9
//
// Created by Paul Hudson on 10/06/2015.
// Learn Swift at www.hackingwithswift.com
// @twostraws
//
import UIKit
import Foundation.NSNotification
#if !COCOAPODS
import PromiseKit
#endif
/**
To import the `NSNotificationCenter` category:
use_frameworks!
pod "PromiseKit/Foundation"
const int MAX_TOUCHES= 11; //Oops, it can handle 11, not 10. Thanks @Bob_at_BH
class TouchTrack
{
public:
TouchTrack()
{
m_touchPointer = NULL;
}
@apache2046
apache2046 / imagenet1000_clsidx_to_labels.txt
Created August 18, 2020 07:26 — forked from yrevar/imagenet1000_clsidx_to_labels.txt
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@apache2046
apache2046 / iptables-cheatsheet.md
Created September 28, 2020 06:50 — forked from mcastelino/iptables-cheatsheet.md
iptables-cheatsheet

The netfilter hooks in the kernel and where they hook in the packet flow

The figure below calls out

  • The netfilter hooks
  • The order of table traversal
@apache2046
apache2046 / route_based_on_uid.sh
Created June 28, 2022 09:39 — forked from gunkaaa/route_based_on_uid.sh
Use separate gateway based on iptables owner (UID)
#!/bin/bash
# (In this case) default gateway is 192.168.1.3, alternate is 192.168.1.1.
# Usually default is either .1 or .254 - pay attention.
# If anything involving CDNs is involved, use https://github.com/hadess/resolvconf-override .
# Add new routing table, which uses alternate gateway by default
echo 100 altgateway >> /etc/iproute2/rt_tables
# Mark traffic sourced from UID as needing to go via other gateway (4 is arbitrary)