Skip to content

Instantly share code, notes, and snippets.

View ramonfritsch's full-sized avatar

Ramon Fritsch ramonfritsch

View GitHub Profile
@ramonfritsch
ramonfritsch / mrr.js
Created February 5, 2022 13:33
scriptable-mrr
const API_KEY = 'YOUR_API_KEY';
const auth = 'Basic ' + btoa(`${API_KEY}:`);
const currentYear = new Date().getYear();
const startDate = `${currentYear}-01-01`;
const endDate = `${currentYear}-12-31`;
const endpoint = `https://api.chartmogul.com/v1/metrics/mrr?start-date=${startDate}&end-date=${endDate}`;
function loadItems() {
const req = new Request(endpoint);
@ramonfritsch
ramonfritsch / expressjs-rewrite.js
Created November 9, 2016 17:06
URL rewrite on ExpressJS 4.0
....
//This is how you'd do on ExpressJS 3.0
app.get('/my/route1/', function (req, res, next) {
req.url = '/other/route2/';
next('route');
});
app.get('/other/route2/', function (req, res, next) {
res.send('I am other route 2');
# Dropbox has a hacky way to take control over your computer without you knowing
# These commands avoid that.
#
# https://news.ycombinator.com/item?id=12463338
# http://applehelpwriter.com/2016/07/28/revealing-dropboxs-dirty-little-security-hack/
# http://applehelpwriter.com/2016/08/29/discovering-how-dropbox-hacks-your-mac/
# 1. Remove executable and suid bits and lock dbaccessperm file.
cd /Library/DropboxHelperTools/Dropbox_u502
@ramonfritsch
ramonfritsch / .bash_profile
Last active July 14, 2016 22:40
My cool bash prompt
function sc_info() {
local sc_type=false
local sc_branch
local sc_dirty=0
if [[ -f .git/HEAD || -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then
# elif which git &> /dev/null && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then
sc_type="git"
local ref=$(git symbolic-ref -q HEAD 2> /dev/null)
var FRAME_TIME = 1000 / 60;
var DAMPING = 0.945;
function applyDamping(vel) {
return vel * DAMPING;
}
function applySpeed(x, vel) {
return x + vel;
}
@ramonfritsch
ramonfritsch / gist:2cb12f6b94e145451b6e
Created January 13, 2016 21:49
Create root user on MongoDB
use admin;
db.createUser(
{
user: "user",
pwd: "pass",
roles: [ "root" ]
}
);
use database;