Skip to content

Instantly share code, notes, and snippets.

View askdaddy's full-sized avatar

Seven Chan askdaddy

  • Internet
View GitHub Profile
@halberom
halberom / 0_play.yml
Last active November 5, 2021 18:13
ansible - example of calling a handler when a fact is set
---
- hosts: localhost
connection: local
gather_facts: False
tasks:
- debug: msg="call handler"
changed_when: True
notify: do something
handlers:
@xanathar
xanathar / main.cpp
Created June 15, 2016 09:30
Simple example of Lua integration in C++
//
// main.cpp
// LuaTests
//
// Created by Marco Mastropaolo on 08/06/16.
// Copyright © 2016 Marco Mastropaolo. All rights reserved.
//
#include <iostream>
#include "../include/lua.hpp"
@uglide
uglide / install-teamcity.md
Last active November 23, 2017 02:51 — forked from sandcastle/install-teamcity.md
Install TeamCity 9.1.6 on Ubuntu with Nginx
@joshnuss
joshnuss / app.js
Last active March 4, 2024 00:01
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
--- git.js 2015-05-11 16:19:29.114852900 -0400
+++ git-patched.js 2015-05-11 16:19:35.788234600 -0400
@@ -12,14 +12,23 @@
, git = npm.config.get("git")
, assert = require("assert")
, log = require("npmlog")
+ , win32 = process.platform === "win32"
+ , cygwin = win32 && (process.env.ORIGINAL_PATH || '').indexOf('/cygdrive/') != -1
function prefixGitArgs () {
@hideki
hideki / Issue330Test
Created January 16, 2015 00:01
Sample code how to set custom SSLSocketFactory for Couchbase Lite Android/Java
package com.couchbase.lite;
import android.net.SSLCertificateSocketFactory;
import android.os.Build;
import android.test.AndroidTestCase;
import android.util.Log;
import com.couchbase.lite.android.AndroidContext;
import com.couchbase.lite.replicator.Replication;
import com.couchbase.lite.support.CouchbaseLiteHttpClientFactory;
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
error_log /tmp/nginx_debug_error.log debug;
#pid logs/nginx.pid;
@shuax
shuax / decorator
Created July 2, 2014 06:07
lua decorator,类似python那样的装饰器
local function decorator(str)
local rebuild_str = {}
local rebuild_fun = "(\0)"
local state = 0
for line in str:gmatch('[^\r\n]+') do
if line:find("@") then
rebuild_fun = string.format("(%s"..rebuild_fun..")", line:sub(2))
state = 1
else
if state==0 or state==3 then
@romanov
romanov / gist:abc494ee7b08f232f539
Last active January 16, 2016 14:40
node-webkit debug on Windows via Powershell
# path to nw.exe
$nodePath = "d:\Projects\node-webkit-v0.9.2-win-ia32\nw.exe"
# release file path
$releaseFile = "d:\Projects\app.nw"
# path to the app project
$appFolder = "d:\Projects\nodeApp1\app"
function ZipFiles( $zipfilename, $sourcedir )
{
Add-Type -Assembly System.IO.Compression.FileSystem
@DavidWittman
DavidWittman / mongo-ansible.py
Last active April 18, 2023 18:16
MongoDB-backed dynamic inventory script for Ansible
#!/usr/bin/env python
#
# MongoDB-backed dynamic inventory script for Ansible
# http://docs.ansible.com/intro_dynamic_inventory.html
import os
from argparse import ArgumentParser
import pymongo