Skip to content

Instantly share code, notes, and snippets.

@bellbind
bellbind / binding.gyp
Last active June 20, 2024 18:22
[nodejs]Native module with libuv and v8::Promise on node-4
# -*- mode: python -*-
{
"targets": [
{
"include_dirs": ["<!(node -e \"require('nan')\")"],
"target_name": "TimerAndPromise",
"sources": [
"timer-and-promise.cc"
],
"conditions": [
@awidegreen
awidegreen / pia_swe.ovpn
Last active September 25, 2024 12:51
rtorrent through openvpn
client
dev tun
# "Allow calling of built-in executables and user-defined scripts." In other
# words, this must be specified for the `up` script to be executed.
script-security 2
route-nopull
up vpn-up.sh
down vpn-down.sh
@yiding
yiding / gist:1bfe9bbf5187a6ff6f34
Created June 30, 2014 19:03
WebRTC native, forcing ports to be allocated in a certain range.
class PortAllocatorFactoryWrapper : public PortAllocatorFactory {
public:
PortAllocatorFactoryWrapper(talk_base::Thread* worker_thread, int minPort, int maxPort)
: PortAllocatorFactory(worker_thread), minPort_(minPort), maxPort_(maxPort) {}
virtual cricket::PortAllocator *CreatePortAllocator(
const std::vector<StunConfiguration> &stun,
const std::vector<TurnConfiguration> &turn) override {
auto allocator = PortAllocatorFactory::CreatePortAllocator(stun, turn);
allocator->SetPortRange(minPort_, maxPort_);
@gabrielef
gabrielef / SanitizeUrl.php
Last active June 23, 2017 19:48
Convert title to seo friendly url
<?php
class SanitizeUrl {
public static function slug($string, $space="-") {
$string = utf8_encode($string);
if (function_exists('iconv')) {
$string = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
}
$string = preg_replace("/[^a-zA-Z0-9 \-]/", "", $string);
@jjgod
jjgod / checkout-chromium-release-branches.markdown
Last active January 12, 2024 09:30
Steps to checkout Chromium release branches

Steps to checkout Chromium release branches

Initial setup

mkdir chromium && cd chromium
fetch --nohooks chromium --nosvn=True
gclient sync --with_branch_heads --nohooks # May not even need this.

Fetching/updating a specific release branch

@Liryna
Liryna / ARMDebianUbuntu.md
Last active October 13, 2024 16:16
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@soarez
soarez / ca.md
Last active October 29, 2024 18:12
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@CodingFu
CodingFu / deviseCheck.js
Created November 13, 2013 00:08
Simple devise user login check in node.js
var mysql = require('mysql')
, bcrypt = require('bcrypt')
, db = {
host: 'localhost',
user: 'root',
database: 'prod'
};
function checkUser(email, password, callback) {
var connection = mysql.createConnection(db);
@mtigas
mtigas / gist:952344
Last active October 16, 2024 09:03
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes: