Skip to content

Instantly share code, notes, and snippets.

View shimaore's full-sized avatar
🏕️

Stéphane Alnet shimaore

🏕️
View GitHub Profile
@shimaore
shimaore / named.vim
Created August 26, 2014 12:49
Vim: update bind9 serial numbers automatically when loading file
" Inspired by http://www.debian-administration.org/article/381/Updating_bind_serial_numbers_automatically
function UPDSERIAL(date, num)
if (strftime("%Y%m%d") == a:date)
return a:date . a:num+1
endif
return strftime("%Y%m%d") . '01'
endfunction
command Soa :%s/\(2[0-9]\{7}\)\([0-9]\{2}\)\(\s*;\s*serial\s*\)/\=UPDSERIAL(submatch(1),submatch(2)) . submatch(3)/g
@shimaore
shimaore / node-stringprep-build-error.txt
Created September 2, 2014 12:21
Debian build of node-stringprep fails
stephane@voyageur:~/Public/src/node-stringprep…master$ npm install
> node-stringprep@0.5.2 install /srv/home/stephane/Public/src/node-stringprep
> node-gyp rebuild
make: Entering directory '/srv/home/stephane/Public/src/node-stringprep/build'
CXX(target) Release/obj.target/node_stringprep/node-stringprep.o
SOLINK_MODULE(target) Release/obj.target/node_stringprep.node
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
@shimaore
shimaore / yt-dl-#4283.txt
Created November 23, 2014 17:43
Log with --verbose
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['--verbose', 'https://www.youtube.fr/watch?v=5UHBIjPOwLw']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2014.08.05
[debug] Python version 2.7.8 - Linux-3.16.0-4-amd64-x86_64-with-debian-jessie-sid
[debug] Proxy map: {}
[generic] watch?v=5UHBIjPOwLw: Requesting header
[redirect] Following redirect to https://www.youtube.com/watch?gl=FR&hl=fr&v=5UHBIjPOwLw
[youtube] Setting language
class Zappa
constructor: ->
...
@locals =
app: (name,server) => @app name,server
...
app: (name,server) ->
@ensure_app name,server
@current_app = @apps[name]
@shimaore
shimaore / couchapp+auth.patch
Created February 23, 2011 14:46
A simple patch to add one argument (the Base64-encoded value of the "Basic" authorization HTTP header) to node.couchapp.js.
diff --git a/bin.js b/bin.js
index 21a4f35..4a7c8ae 100755
--- a/bin.js
+++ b/bin.js
@@ -14,6 +14,7 @@ var node = process.argv.shift()
, command = process.argv.shift()
, app = process.argv.shift()
, couch = process.argv.shift()
+ , auth = process.argv.shift()
;
@shimaore
shimaore / zappa-express.diff
Created June 16, 2011 13:14
Zappa diff to implement #25
diff -rub -x .git zappa-github//src/zappa.coffee zappa/src/zappa.coffee
--- zappa-github//src/zappa.coffee 2011-06-16 15:12:35.000000000 +0200
+++ zappa/src/zappa.coffee 2011-05-16 20:33:06.000000000 +0200
@@ -15,7 +15,7 @@
@current_app = null
@locals =
- app: (name) => @app name
+ app: (name,server) => @app name, server
include: (path) => @include path
@shimaore
shimaore / gist:1046898
Created June 25, 2011 21:06
Fix for node.couchapp.js issue #15
diff --git a/main.js b/main.js
index fa8466f..221ed8b 100644
--- a/main.js
+++ b/main.js
@@ -8,8 +8,6 @@ var path = require('path')
, spawn = require('child_process').spawn
;
-var h = {'content-type':'application/json', 'accept-type':'application/json'}
-
@shimaore
shimaore / explained.coffee
Created September 9, 2011 00:49
(proof-of-concept) Zappa with runInContext() to provide glocal vars
zappa =
run: (f)->
# Re-compile the function in a context that contains the Zappa
# methods as globals.
vm = require 'vm'
code = 'zappa_code='+f.toString()
views = {}
router = {}
@shimaore
shimaore / noclobber-proper.diff
Created September 20, 2011 07:42
Setting 'noclobber' allows @ to contain the data while the zappa context is passed as an argument. Setting 'dataparam' keeps @ as the context while the data is passed as an argument.
diff -ru mauricemach-zappa-ac57545//src/zappa.coffee zappa-noclobber//src/zappa.coffee
--- mauricemach-zappa-ac57545//src/zappa.coffee 2011-09-17 03:12:51.000000000 +0200
+++ zappa-noclobber//src/zappa.coffee 2011-09-20 10:42:15.000000000 +0200
@@ -285,12 +285,19 @@
names = []
names.push k for k, v of ctx
+ data = [req.query, req.params, req.body]
+
if app.settings['autoimport']
@@ -280,10 +280,38 @@ zappa.app = (func,disable_io,require_css) ->
if typeof arguments[0] isnt 'object'
render.apply @, arguments
else
for k, v of arguments[0]
render.apply @, [k, v]
+ include: (paths) ->
+
+ _end = res.end
+ _write = res.write