Skip to content

Instantly share code, notes, and snippets.

View iRet's full-sized avatar

Artyom Nikolaev iRet

  • Vancouver, BC
View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define B 4
static unsigned char* ntb(unsigned char b[], unsigned int n) {
b[0] = n >> 24;
b[1] = n >> 16;
b[2] = n >> 8;
@epicserve
epicserve / example.com.import.txt
Last active March 11, 2023 14:04
Example Terraform file for importing DNS Records from DigitalOcean
digitalocean_domain.example example.com
digitalocean_record.example example.com,<DO ID>
digitalocean_record.fd-gmail-txt example.com,<DO ID>
digitalocean_record.fd-mx["alt1.aspmx.l.google.com."] example.com,<DO ID>
digitalocean_record.fd-mx["alt2.aspmx.l.google.com."] example.com,<DO ID>
digitalocean_record.fd-mx["aspmx.l.google.com."] example.com,<DO ID>
digitalocean_record.fd-mx["aspmx2.googlemail.com."] example.com,<DO ID>
digitalocean_record.fd-mx["aspmx3.googlemail.com."] example.com,<DO ID>
digitalocean_record.fd-ns["1"] example.com,<DO ID>
digitalocean_record.fd-ns["2"] example.com,<DO ID>
@haccks
haccks / postfix_mail_macosx.md
Last active March 29, 2024 23:27
Send mail from local host using postfix on MacOS High Sierra.

Setting up postfix on MacOS High Sierra

MacOS Sierra High comes with preinstalled postfix. Follow these steps to configure it on a local system:

1. Create a sasl_passwd file

sudo nano /etc/postfix/sasl_passwd
  • Add this to the file
@denisoster
denisoster / nginx.conf
Last active April 13, 2024 12:17
Nginx+RoR(Puma)+SSL+redirect
upstream site {
server unix:/home/site/web/site.com.ua/site/shared/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name site.com.ua www.site.com.ua;
rewrite ^(.+)$ https://site.com.ua$uri permanent;
}
@danigb
danigb / setup.md
Last active July 27, 2022 08:32
Vagrant setup for ruby 1.8

How to create and setup a development virtual machine for old ruby/rails

Using VirtualBox and Vagrant

Install and create a virtual machine

Install virtualbox and Vagrant:

$ brew cask install virtualbox
@wafiq
wafiq / rails-5-6-ubuntu-mina-puma-nginx.md
Last active November 27, 2023 02:43
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
@jwalanta
jwalanta / OpenWrt detect new device and send text message.md
Last active February 10, 2024 09:16
Detect new network devices connecting to OpenWrt and send text message
@PavloBezpalov
PavloBezpalov / 1. ELK.install
Last active January 5, 2024 16:14
ELK Stack with Rails (Elasticsearch, Logstash, Kibana) on Ubuntu VPS
INSTALL JAVA
$ sudo apt-get update && sudo apt-get install default-jre
INSTALL ELASTIC SEARCH https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
$ wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
$ echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
$ sudo apt-get update && sudo apt-get install elasticsearch
$ sudo update-rc.d elasticsearch defaults 95 10
$ sudo service elasticsearch restart
$ sudo service elasticsearch status
@damien
damien / date_time_comparisons_in_active_support.md
Last active July 15, 2016 14:15
Quick dive into how Rails/ActiveSupport does Date, Time, and DateTime comparisons

Date and Time comparisons in ActiveSupport

Question: How do we safely compare a date to an unknown value within a Rails application? Example: params[:date_field] > 2.years.ago

Doing a bit of digging, it looks like 2.years.ago returns an instance of ActiveSupport::TimeWithZone. In ruby, whenever you do a comparison of any sort ruby will follow the rules outlined in the Comparable module of stdlib.

ActiveSupport::TimeWithZone will create a instance of Time in a UTC time zone when doing comparisons with ActiveSupport::TimeWithZone#&lt;=&gt;.

@smford22
smford22 / chef_local_development_workflow.md
Last active November 1, 2023 00:07
Chef Local Development Workflow - ChefDK, Vagrant, VirtualBox, Test Kitchen

Chef Local Development Workflow with ChefDK, Vagrant, VirtualBox, and Test Kitchen

Overview

The following document is intended to be a quick guide to getting you setup for doing local development with Chef. This guide was created on my MacBook, but should work fine with Linux, and Windows workstations as well.

Quick review on fundamental tenets of Chef

  • Workstation - A workstation is a computer that is configured to run various Chef command-line tools that synchronize with a chef-repo, author cookbooks, interact with the Chef server, interact with nodes, or applications like Chef Delivery
  • Node - A node is any machine—physical, virtual, cloud, network device, etc.—that is under management by Chef.
  • Chef Server- The Chef server acts as a hub for configuration data. The Chef server stores cookbooks, the policies that are applied to nodes, and metadata that describes each registered