Skip to content

Instantly share code, notes, and snippets.

View mofax's full-sized avatar
🎯
Focusing

Alloys Mila mofax

🎯
Focusing
View GitHub Profile
execve("/usr/local/bin/flynn", ["flynn", "version"], [/* 64 vars */]) = -1 EFAULT (Bad address)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SI_USER, si_pid=9411, si_uid=1000} ---
+++ killed by SIGSEGV +++
Segmentation fault (core dumped)
@mofax
mofax / Git push deployment in 7 easy steps.md
Created November 4, 2015 09:29 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@mofax
mofax / matrix.py
Last active March 31, 2016 14:26
absolute difference of NxN square matrix diagonals
#! /usr/bin/env python
"""
abs_diag_sum
a function to find the absolute difference of the sum of diagonals of an NxN square matrix
where the square matrix is represented as list of lists
such that the square matrix
@mofax
mofax / eslintrc
Last active March 6, 2017 10:08
my eslint config...
{
// http://eslint.org/docs/rules/
"env": {
"browser": true, // browser global variables.
"node": true, // Node.js global variables and Node.js-specific rules.
"worker": false, // web workers global variables.
"amd": false, // defines require() and define() as global variables as per the amd spec.
"mocha": true, // adds all of the Mocha testing global variables.
"jasmine": true, // adds all of the Jasmine testing global variables for version 1.3 and 2.0.
"phantomjs": false, // phantomjs global variables.
@mofax
mofax / index.js
Created March 2, 2017 08:15
automatically require all files inside a directory via an index.js
'use strict';
let fs = require('fs');
let path = require('path');
function snakeToCamel(s) {
let strings = s.split('_').map((str, index) => {
if (index === 0) return str;
return str.replace(/(^| )(\w)/g, function (x) {
return x.toUpperCase();
@mofax
mofax / simplerouter.js
Last active March 15, 2017 12:13
routing on the frontend
'use strict';
/**
* change the browser location hash
*/
function changeRoute(path, global) {
// switch the location hash of the page
if (!path.startsWith('/')) {
path = '/' + path.trim();
}
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"noImplicitAny": false,
"sourceMap": true,
"outDir": "build"
},
"exclude": [
{
"defaultSeverity": "error",
"extends": ["tslint-config-airbnb", "tslint-react", "tslint-config-prettier"],
"jsRules": {},
"rules": {
"variable-name": false,
"function-name": false,
"jsx-no-lambda": false
},
"rulesDirectory": []
@mofax
mofax / install-sublime-text.sh
Created August 29, 2018 06:37
Install sublime-text Ubuntu >= 16.04
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt update
sudo apt install sublime-text
@mofax
mofax / postgres-cheatsheet.md
Created November 20, 2018 12:00 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)