Skip to content

Instantly share code, notes, and snippets.

View a-rmz's full-sized avatar

Alejandro Ramírez a-rmz

View GitHub Profile
@a-rmz
a-rmz / django-project.md
Created March 11, 2022 07:22
Setting up a new Django project

Install python (pyenv or asdf)

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.9.0

echo ". $HOME/.asdf/asdf.sh" >> ~/.bashrc
echo ". $HOME/.asdf/completions/asdf.bash" >> ~/.bashrc

asdf info

asdf plugin-add python
from django.db.models import Q
from leases.models import BerthLease
from payments.enums import OrderStatus
from resources.enums import BerthMooringType
from resources.models import Berth
berths = Berth.objects.filter(
Q(
Q(berth_type__mooring_type__in=(BerthMooringType.DINGHY_PLACE, BerthMooringType.TRAWLER_PLACE))
from payments.enums import OrderStatus
from payments.models import Order
from resources.enums import BerthMooringType
orders = Order.objects.filter(
status=OrderStatus.ERROR,
comment__contains="Asiakkaan sähköpostiosoite puuttuu"
)
for order in orders:
if order.lease.berth.berth_type.mooring_type not in (BerthMooringType.DINGHY_PLACE, BerthMooringType.TRAWLER_PLACE):
import re
from payments.enums import OrderStatus
from payments.models import Order
from resources.models import WinterStorageArea
orders = Order.objects.filter(
_lease_object_id=None, status=OrderStatus.PAID, comment__icontains="Paikka:"
)
@a-rmz
a-rmz / palindrome_number.cpp
Created October 9, 2017 19:38
Find if a number is palindrome.
#include <iostream>
#include <math.h>
using namespace std;
bool is_palindrome(long int);
int digits(long int);
int main(int argc, char ** argv) {
long int n = stol(argv[1]);
@a-rmz
a-rmz / XOR.py
Created July 21, 2017 21:04
A basic Neural Network that solves the XOR problem
import numpy as np
np.random.seed(14)
def sigmoid(x, deriv=False):
if deriv:
return x * (1 - x)
return 1 / (1 + np.exp(-x))
@a-rmz
a-rmz / .gitconfig
Last active August 29, 2017 07:11
Gitconfig
[user]
name =
email =
[core]
editor = vim
[log]
decorate = true
abbrevCommit = true
[color "branch"]
current = yellow bold
@a-rmz
a-rmz / .vimrc
Last active July 21, 2017 21:16
Vim config @ alexbook
set nocompatible " be iMproved, required
filetype off " required
"execute pathogen#infect()
call plug#begin('~/.vim/plugged')
" vim-plug plugins
" Solarized colors
Plug 'altercation/vim-colors-solarized'
" Monokai
@a-rmz
a-rmz / .vimrc
Last active August 29, 2017 07:06
Vim config @ Lucy
" ======================================
" Plugin setup
" ======================================
" Load the plugins
call plug#begin('~/.vim/plugged')
" Themes
Plug 'kristijanhusak/vim-hybrid-material'
Plug 'mhartington/oceanic-next'
Plug 'NLKNguyen/papercolor-theme'
@a-rmz
a-rmz / keybase.md
Last active September 30, 2017 16:41

Keybase proof

I hereby claim:

  • I am a-rmz on github.
  • I am armz (https://keybase.io/armz) on keybase.
  • I have a public key ASBgzkeVpbd9O2qX1eW1C5mqPxT2aZS6U5oL29q3MclbEAo

To claim this, I am signing this object: