Skip to content

Instantly share code, notes, and snippets.

class BaseModel extends Model {
static get allRelations() {
return '[' + Object.keys(this.relationMappings).join(',') + ']';
}
}
//And then inherit your models from that instead of Model.
class Person extends BaseModel {
//...
@burningTyger
burningTyger / sencond_deploy.md
Last active August 30, 2017 08:08
How to deploy your openshift app to a second instance

##How to deploy your openshift app to a second instance

I set up Moodle for myself on Openshift which I explained here: https://github.com/burningTyger/openshift_moodle

Now I wanted to install Moodle for a friend who has his own user and his own domain on openshift. Since I'm the admin why bother creating a second app which is basically the exact same app as mine and will most cetainly need the exact same updates. DRY!

So I decided to find out how I can use the app repo on two different instances of openshift. This is how it works (there might be better solutions, let me know):

You log in as the second user and create a new app. This will give you a git URL. Copy this URL and head over to you app repo (Moodle used in this example):

@burningTyger
burningTyger / README.md
Created January 28, 2017 20:15 — forked from pnavarrc/README.md
Jade Preview
@burningTyger
burningTyger / sequel_to_ms_access.rb
Created December 12, 2016 17:16 — forked from thinkAmi/sequel_to_ms_access.rb
Sequel: Connecting to Microsoft Access(*.accdb)
# Tested Environment
# Windows7 x64, MS Access2010/2013, sequel 4.11.0
# Gemfile
# source 'https://rubygems.org'
# gem 'sequel'
# gem 'ruby-odbc' # for ODBC
require 'sequel'
@burningTyger
burningTyger / docker.gogs.service.md
Last active August 13, 2016 16:39
Docker Gogs systemd script

Starting Gogs as a Docker container on startup via systemd

Gogs is that great Github clone which is also available as a docker image. Works perfectly if started by the user but since you probably want to run it on your server and without interruption you can add a systemd script to start up Gogs on boot. My script looks like this:

# /etc/systemd/system/docker.gogs.service
[Unit]
Description=Gogs container
Requires=docker.service
Require=postgresql.service
@burningTyger
burningTyger / howto.md
Created July 13, 2016 16:06
How to update Cyanogenmod 13 with an internal SD card (encrypted)

My tablet runs the latest nightly of cm-13 and twrp. However, a bug in twrp doesn't let me update cm nightlies. So wherever I try to story my nightly I can't access it from twrp. Root doesn't work either for some reason so I'm stuck with a tablet that runs cm-13 but without updates.

After investing some time I tried connecting the tablet to a laptop while in recovery mode. Plugged in a USB cable on both sides and voila I had access to a twrp folder which was also mounted in recovery mode. Copied my cm-13 file there and was successfully able to install the nightly.

Connecting a USB thumb drive didn't work either btw.

@burningTyger
burningTyger / testports.sh
Created March 7, 2016 10:06 — forked from enginefeeder101/testports.sh
Test outgoing open ports
#!/bin/bash
task(){
LC_ALL=C nc -vzw5 portquiz.net $1 2>&1 | grep -v 'Connection timed out'
}
N=50 # Specify number of ports to check at once
(
for port in {1..65535}; do # Specify port range to check here
((i=i%N)); ((i++==0)) && wait
@burningTyger
burningTyger / upgrade_moodle.sh
Created January 11, 2016 08:06
This is my upgrade script for moodle. Has worked flawlessly for the last two years.
# depending on where you keep your moodle files this is how I'm doing it.
# works on any branch, for major upgrade you need to run this file a last time on the current branch
# then cd into the moodle dir and `git branch` into the newer version in order to get
# the latest updates. Then run the script again to activate.
cd /usr/share/nginx/html/moodle
sudo -u www-data php /usr/share/nginx/html/moodle/admin/cli/maintenance.php --enable;git pull
sudo -u www-data php /usr/share/nginx/html/moodle/admin/cli/upgrade.php
sudo -u www-data php /usr/share/nginx/html/moodle/admin/cli/maintenance.php --disable
sudo -u www-data php /usr/share/nginx/html/moodle/admin/cli/cron.php;cd
#set-option -g default-terminal "screen-256color"
#set -g default-terminal "screen-256color"
set -g mode-mouse on
set-window-option -g mode-mouse on
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
@burningTyger
burningTyger / exif_rename
Created January 9, 2014 14:40
quickly rename JPG to my preferred file format based on exif data
for i in *.JPG; do exiv2 -v -r '%Y-%-m-%d_%H-%M%-%S' rename "$i"; done