Skip to content

Instantly share code, notes, and snippets.

@jancel
jancel / hostXMRNode.md
Created February 18, 2024 01:05 — forked from tannerdsilva/hostXMRNode.md
How To Build And Host a Monero Node from Source

How to Build and Install a Monero Node on a Debian-based System

Hello. In this document, we will walk through the steps of building and hosting your own Monero node from source on a Debian-based Linux system. These systems include Raspbian, Debian (9 and above), and Ubuntu (18.04 and above). This tutorial assumes that you are capable of accessing the ROOT terminal of your Debian-based system, and are capable of getting your system online if necessary. You may plan on using an external storage device to store the blockchain, this tutorial will include the optional steps to support external storage. Alternatively, this setup procedure can also accomodate users looking to host a pruned blockchain with restricted storage space.

Here are some useful links for reaching this prerequisite if you do not currently have access to a Debian-based system that meets the recommended system requirements.

def fizzbuzz( number, index = 1 )
# Do this in one pass
value = ""
value += "fizz" if (index % 3 == 0)
value += "buzz" if (index % 5 == 0)
p value
# and next number
fizzbuzz( number, index + 1 )
@jancel
jancel / pg_dump_restore.sh
Created January 12, 2024 18:18
Short script that will copy a postgres database to somewhere given URLs (Can change username and database name)
#!/bin/bash
: "${SOURCE:?Please provide a SOURCE which should be a database url}"
: "${TARGET:?Please provide a TARGET which should be a database url}"
dump_path=dump
if [ -d "$dump_path" ]; then
echo "/$dump_path already exists. Please remove ./$dump_path before running this script."
exit 1
@jancel
jancel / gist:ff55b3d0d6d6c4ddbc60e3644938c5f0
Created January 12, 2024 17:20
Rails Database.yml Example with Rails.credentials
default: &default
adapter: postgresql
encoding: unicode
url: <%= ENV.fetch('DATABASE_URL') { Rails.application.credentials.database_url } %>
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
"<%= Rails.env %>":
<<: *default
@jancel
jancel / Dockerfile
Created May 30, 2023 16:46
Installing SQL Server Tools on Debian 10
FROM debian:10
################################################################
# Install bulk copy program (bcp)
################################################################
RUN apt install -y gnupg2 apt-transport-https wget curl
RUN wget -q -O- https://packages.microsoft.com/keys/microsoft.asc | \
gpg --dearmor | tee /usr/share/keyrings/microsoft.gpg > /dev/null 2>&1
RUN echo "deb [signed-by=/usr/share/keyrings/microsoft.gpg arch=amd64,armhf,arm64] https://packages.microsoft.com/debian/10/prod buster main" | \
tee /etc/apt/sources.list.d/prod.list
@jancel
jancel / gist:1367606
Created November 15, 2011 17:01 — forked from r00k/gist:906356
Custom devise strategy
# In config/initializers/local_override.rb:
require 'devise/strategies/authenticatable'
module Devise
module Strategies
class LocalOverride < Authenticatable
def valid?
true
end
#config/production.rb (line 1)
def compile_asset?(path)
# ignores any filename that begins with '_' (e.g. sass partials)
# all other css/js/sass/image files are processed
if File.basename(path) =~ /^[^_].*\.\w+$/
puts "Compiling: #{path}"
true
else
puts "Ignoring: #{path}"
def build_table
build_table_head
build_table_body unless @collection.blank?
end
versus
def build_table
build_table_head
@jancel
jancel / gist:913662
Created April 11, 2011 15:07
an example from my parser
require 'spec_helper'
describe Parser do
def parser(str = nil)
Parser.new(str)
end
describe "when initialized" do
describe "with a valid string" do
#application controller
around_filter :update_user_seen_on
def update_user_seen_on
yield
if signed_in?
current_user.last_seen_on = DateTime.now
current_user.save