Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
TMPFILE="/tmp/innobackupex-runner.$$.tmp"
USEROPTIONS="--user=XXX --password=XXX"
FILTERTABLES="--include=.*[.].*"
BACKDIR=/var/mysql-bak
BASEBACKDIR=$BACKDIR/base
INCRBACKDIR=$BACKDIR/incr
FULLBACKUPLIFE=3600 #604800 # How long to keep incrementing a backup for, minimum 60
KEEP=1 # Keep this number of backups, appart form the one currently being incremented
#!/bin/sh
#
# Script to prepare and restore full and incremental backups created with innobackupex-runner.
#
# (C)2010 Owen Carter @ Mirabeau BV
# This script is provided as-is; no liability can be accepted for use.
# You are free to modify and reproduce so long as this attribution is preserved.
#
# (C)2013 Benoît LELEVÉ @ Exsellium (www.exsellium.com)
# Adding parameters in order to execute the script in a multiple MySQL instances environment
@veeramarni
veeramarni / async.js
Created December 11, 2015 22:47 — forked from cmather/async.js
Async call from within a Meteor server side method.
if (Meteor.isServer) {
var Fiber = Npm.require('fibers');
function async (cb) {
Meteor.setTimeout(function () {
cb(null, 'hello');
}, 3000);
}
Meteor.methods({
@veeramarni
veeramarni / devert
Created December 22, 2015 10:39 — forked from cfr/devert
Fix vertical video
#!/usr/bin/env sh
# http://stackoverflow.com/a/30819570/187663
ffmpeg -i $1 -i $1 -filter_complex "[0:v]scale=-1:720[scaled_video];[1:v]scale=1280:720,boxblur=16[blur_image];[blur_image][scaled_video]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[outv]" -c:v libx264 -aspect 1280/720 -map [outv] -map 0:a -c:a copy $1.fixed.mp4
@veeramarni
veeramarni / meteor-async.md
Created January 4, 2016 16:42 — forked from possibilities/meteor-async.md
Meteor Async Guide

From Meteor's documentation:

In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.

This guide serves as a mini-tour of tools, trix and patterns that can be used to run async code in Meteor.

Basic async

Sometimes we need to run async code in Meteor.methods. For this we create a Future to block until the async code has finished. This pattern can be seen all over Meteor's own codebase:

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
vscode uses its own DI.
https://github.com/Microsoft/vscode/issues/4274
https://github.com/joelday/decoration-ioc
@veeramarni
veeramarni / client-test.ts
Last active April 9, 2019 22:33
Apollo Client Test Sample
import { ApolloClient } from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { withClientState } from 'apollo-link-state';
import { ApolloLink } from 'apollo-link';
import gql from 'graphql-tag';
import 'jest';
describe('Apollo Client tests', () => {
@veeramarni
veeramarni / server-test.ts
Last active April 17, 2019 20:06
Apollo-Server-with-Client
import gql from 'graphql-tag';
import 'jest';
import { createTestClient } from 'apollo-server-testing';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { ApolloServer } from 'apollo-server';
/**
* Server side graphql test uses createTestClient from
* https://github.com/apollographql/apollo-server/blob/master/packages/apollo-server-testing/src/createTestClient.ts
test('test rxjs marble', async () => {
const testScheduler = new TestScheduler((actual, expected) => {
expect(actual).toEqual(expected);
});
const fetchUserEpic = (action$, state$, { getJSON }) => action$.pipe(
ofType('FETCH_USER'),
mergeMap(action =>
getJSON(`https://api.github.com/users/${action.id}`).pipe(
map(response => ({ type: 'FETCH_USER_FULFILLED', response }))