Skip to content

Instantly share code, notes, and snippets.

View dongalor's full-sized avatar
💻
coding

Garblovian dongalor

💻
coding
View GitHub Profile
@dongalor
dongalor / MinecraftService.md
Created January 14, 2023 11:53 — forked from dotStart/MinecraftService.md
Systemd services for Minecraft Servers

Minecraft systemd Services

This gist contains service descriptors which may be used to automatically start and re-start Minecraft servers using systemd. This allows proper control of your server startup on modern Linux distributions and will automatically manage all required tasks on startup for you.

Requirements

@dongalor
dongalor / [email protected]
Created August 30, 2021 17:55 — forked from elie222/[email protected]
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
@dongalor
dongalor / i3 config
Created August 9, 2021 21:47 — forked from marcusscomputer/i3 config
marcus-s i3 config
# Modifier Key (Super)
set $mod Mod4
# No mouse focus
focus_follows_mouse no
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:Noto Sans 11
@dongalor
dongalor / csrf_for_every_xhr.js
Created July 20, 2020 23:02
CSRF FOR ALL THE XHR
(function() {
var send = XMLHttpRequest.prototype.send,
token = $('meta[name=csrf-token]').attr('content');
XMLHttpRequest.prototype.send = function(data) {
this.setRequestHeader('X-CSRF-Token', token);
return send.apply(this, arguments);
};
}());
@dongalor
dongalor / rails-5-6-ubuntu-mina-puma-nginx.md
Created June 22, 2020 17:06 — forked from wafiq/rails-5-6-ubuntu-mina-puma-nginx.md
How to deploy Rails 5/6 in Ubuntu VM using Mina deployment with Puma webserver and Nginx

Rails 5 and 6 Deployment with Ubuntu, Mina, Puma and Nginx

Based on this tutorial but simplified and inlined. Particularly removed any Rails and 3rd party services part, assumed you just need deployment to any Ubuntu machine.

Prerequisite

  1. A functional Rails app
  2. Hosted Git repository (Github, Bitbucket, Gitlab)
  3. Cloud hosting account (Digital Ocean, Vultr, Linode, Lightsail)
  4. Local SSH account

install nodejs

sudo apt-get update
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev nodejs yarn
@dongalor
dongalor / 1 setup vps
Created November 29, 2018 11:34 — forked from PavloBezpalov/1 setup vps
Deploy Rails 5.1.1 to VPS(Ubuntu 16.04.2 LTS). Nginx mainline + pagespeed, Puma with Jungle, Capistrano3, PostgreSQL 9.6, RVM, Certbot
root# apt-get update
root# apt-get upgrade
// dependencies for Ruby
root# apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev \
libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev \
libpcre3-dev unzip
// Node.js v7
root# curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
@dongalor
dongalor / error.log
Last active November 25, 2018 17:32
verbose: REQUEST for [POST] /parse/functions/testPush: {
"userId": "0lxi50to62",
"text": "Lorem ipsnum",
"dataPush": {
"subscriberId": "xku6EHzzwD",
"subscriberName": "Lorem",
"code": "6"
}
} method=POST, url=/parse/functions/testPush, x-real-ip=46.39.255.115, x-forwarded-for=46.39.255.115, x-nginx-proxy=true, host=jamline.ru, connection=close, content-length=153, x-parse-application-id=JAMFABRIC, content-type=application/json, x-parse-master-key=JAMKEY, user-agent=Paw/3.1.7 (Macintosh; OS X/10.13.6) GCDHTTPRequest, userId=0lxi50to62, text=Lorem ipsnum, subscriberId=xku6EHzzwD, subscriberName=lorem, code=6
Sending push to user: 0lxi50to62
Parse.Cloud.define("testPush", async (request) => {
const {params, master, log, headers, ip, functionName} = request;
let userQuery = new Parse.Query(Parse.User);
userQuery.equalTo("objectId", params.userId);
// Find devices associated with these users
let pushQuery = new Parse.Query(Parse.Installation);
pushQuery.matchesKeyInQuery('deviceToken', 'deviceToken', userQuery);
// pushQuery.matchesKeyInQuery('user', userQuery);
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var app = express();
var iosCertPath = process.env.PARSE_CERT || '../certs/my_cert.p12';
var api = new ParseServer({
databaseURI: 'mongodb://user:[email protected]:27017/db', // Connection string for your MongoDB database
cloud: './cloud/main.js', // Absolute path to your Cloud Code
appId: 'APPID',