Skip to content

Instantly share code, notes, and snippets.

View lexaurin's full-sized avatar

lex mourek lexaurin

View GitHub Profile
@Dougley
Dougley / Dockerfile
Created September 5, 2018 12:50
mongodb backblaze b2 backup
FROM mongo
LABEL maintainer="Remco Jongschaap <hello@dougley.com>"
COPY . /opt/b2mongo
WORKDIR /opt/b2mongo
RUN apt update && apt install python3 curl -y
RUN curl https://bootstrap.pypa.io/get-pip.py | python3
RUN pip install --upgrade b2
@ffittschen
ffittschen / gitconfig.md
Last active January 3, 2024 08:40
Use IntelliJ or WebStorm as git mergetool with SourceTree

Use IntelliJ or WebStorm as git mergetool

Configure Sourcetree

The merge tool that ships with JetBrain's IntelliJ IDEA or WebStorm is really awesome and way better than FileMerge. It is quite simple to configure SourceTree to use it as the default mergetool:

  1. Open the SourceTree preferences and select the Diff tab
  2. Choose Custom both as Visual Diff Tool and as Merge Tool
  3. Paste the following commands into the textfields:
  • Diff Command: /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea diff
@MarkTiedemann
MarkTiedemann / README.md
Last active July 18, 2021 11:42
An Easier Way to Enforce Required Parameters in ES6

An Easier Way to Enforce Required Parameters in ES6

Expands on Handling required parameters in ECMAScript 6 by Axel Rauschmayer.

The idea (which is credited to Allen Wirfs-Brock) is, in essence, to use default parameter values to call a function which throws an Error if the parameter is missing:

const throwIfMissing () => { throw new Error('Missing parameter') }
@hpherzog
hpherzog / jessie-mongodb-3-0-x.sh
Created September 13, 2015 11:34
Install mongodb version 3.0.x on debian jessie
#!/bin/sh
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list
apt-get update
apt-get install -y mongodb-org
@branneman
branneman / better-nodejs-require-paths.md
Last active April 25, 2024 13:21
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@tedmiston
tedmiston / nodejs-tcp-example.js
Last active February 19, 2024 21:55
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@lexaurin
lexaurin / .gitconfig
Last active December 11, 2015 11:28
How to manage changelog by git tags? Prefix tags with "v" letter and use this alias:
[alias]
changelog = "!git tag -l v* -n20 | sed -n 'H;${;g;s/\\n[^v]/\\x00/g;p}' | sort -rV | tr \\\\000 \\\\n | less"
@madeye
madeye / ProxySettings.java
Created April 4, 2012 01:53
Set proxy for Android Webview
package me.madeye;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.http.HttpHost;
import android.content.Context;