Skip to content

Instantly share code, notes, and snippets.

View andreineculau's full-sized avatar
:bowtie:

Andrei Neculau andreineculau

:bowtie:
View GitHub Profile
@streunerlein
streunerlein / gist:3332181
Created August 12, 2012 14:58
NPM Mirrors & Proxies

Definition

Mirrors: standalone servers with complete copy of npm registry

Proxies: proxy to the database (couchdb) of npm registry, if only the npm registry server fails but the db works

## HowTo See this gist: https://gist.github.com/3331671

Mirrors

(+) means server is self updating (pulls newest stuff from offical registry when back online again)

@andreineculau
andreineculau / sendmail.app
Last active February 2, 2018 16:41 — forked from masnick/gist:6985205
a nice way to send mail from the shell in osx
#!/usr/bin/env osascript
# usage: sendmail.app from@me.com to@you.com,and@you.com "have you seen this?" "a nice way to send mail/attachment from the shell in osx (if you have configured Mail.app) https://gist.github.com/andreineculau/38f6160cc9aa11956953"
on theSplit(theString, theDelimiter)
-- save delimiters to restore old settings
set oldDelimiters to AppleScript's text item delimiters
-- set delimiters to delimiter to be used
set AppleScript's text item delimiters to theDelimiter
-- create the array
@awerlang
awerlang / lambda.js
Created April 7, 2018 18:18
aws lambda node.js
'use strict';
var net = require('net');
var repl = require('repl');
var util = require('util');
var awslambda = require('./build/Release/awslambda');
const BASE_CONTEXT = Object.freeze({
logGroupName : process.env['AWS_LAMBDA_LOG_GROUP_NAME'],
logStreamName : process.env['AWS_LAMBDA_LOG_STREAM_NAME'],
functionName : process.env['AWS_LAMBDA_FUNCTION_NAME'],
@mhart
mhart / awslambda
Last active April 14, 2019 15:38
node_modules/awslambda
#!/usr/bin/env node
var path = require('path')
var fs = require('fs')
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
require(lib + '/awslambda.js').start_runtime();
@Couto
Couto / Preferences.sublime-settings
Created July 29, 2012 17:19
Sublime Text 2 - User Preferences
// While you can edit this file, it's best to put your changes in
// "User/Preferences.sublime-settings", which overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Themes/Espresso Soda/Espresso Soda.tmTheme",
// Note that the font_face and font_size are overriden in the platform
@jamiehodge
jamiehodge / webmachine.markdown
Last active May 7, 2020 22:21
Webmachine state machine and resource callbacks

Webmachine State Machine

General

  • Service available?
    • callback: service_available?
    • false: 503 Service Unavailable
  • Known method?
    • callback: known_methods
  • absent: 501 Not Implemented
@andreineculau
andreineculau / Andrei.bttpreset.json
Last active July 14, 2020 23:48
Minimalist BetterTouchTool preset
{
"BTTPresetName" : "Andrei",
"BTTPresetColor" : "77.201250, 220.575000, 158.446375, 255.000000",
"BTTGeneralSettings" : {
"BTTPathSampleSize" : 100,
"BTTHTTPServerPort" : 12345,
"BTTCMOnTop" : true,
"ctrlDisables" : false,
"BTTForceForceClickPressure2F" : 700,
"BSTLeftHalfBlock" : true,
@essen
essen / http_specs.md
Last active January 10, 2022 02:01
HTTP and related specifications
@palexander
palexander / gist:2975305
Last active January 21, 2022 14:03
Compiling and running mosh on Dreamhost
# Thanks to @samsonjs for the cleaned up version:
# https://gist.github.com/samsonjs/4076746
PREFIX=$HOME
VERSION=1.2.3
# Install Protocol Buffers
wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2
tar -xf protobuf-2.4.1.tar.bz2
cd protobuf-2.4.1
@mathiasbynens
mathiasbynens / unicodeEscape.js
Created September 26, 2011 19:50
Escape all characters in a string using both Unicode and hexadecimal escape sequences
// Ever needed to escape '\n' as '\\n'? This function does that for any character,
// using hex and/or Unicode escape sequences (whichever are shortest).
// Demo: http://mothereff.in/js-escapes
function unicodeEscape(str) {
return str.replace(/[\s\S]/g, function(character) {
var escape = character.charCodeAt().toString(16),
longhand = escape.length > 2;
return '\\' + (longhand ? 'u' : 'x') + ('0000' + escape).slice(longhand ? -4 : -2);
});
}