Skip to content

Instantly share code, notes, and snippets.

View dashingspidy's full-sized avatar
🎯
Focusing

Arif Hossain dashingspidy

🎯
Focusing
  • Brussels
  • 10:31 (UTC +02:00)
  • X @kawwser
View GitHub Profile
@dashingspidy
dashingspidy / postgres-production-setup.sh
Created October 3, 2024 05:14 — forked from rameerez/postgres-production-setup.sh
PostgreSQL Production Server Setup - Set up a new Ubuntu Server 24.04 LTS machine to run a production Postgres server
#!/bin/bash
# This script takes a clean Ubuntu Server 24.04 LTS image and installs and configures
# everything needed to deploy a production-ready PostgreSQL server.
set -euo pipefail
# --- AESTHETICS ---
GREEN='\033[0;32m'
@dashingspidy
dashingspidy / centos-ami.md
Created August 9, 2024 01:44 — forked from kevincharm/centos-ami.md
AWS CentOS 7 AMI => Setup for root login via SSH

AWS CentOS 7 AMI Setup for mplz

  1. SSH to EC2 then exec sudo visudo then add line centos ALL=(ALL) NOPASSWD:ALL
  2. exec sudo su - root
  3. exec sudo vi /etc/ssh/sshd_config then edit/uncomment line

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dashingspidy
dashingspidy / _form.html.erb
Created June 13, 2024 03:02 — forked from HalfBloody/_form.html.erb
Rails Inline Form Errors
<%= form_for contact do |f| %>
<% if contact.errors.any? %>
<div class="form-errors">
<div class="alert shadow-lg alert-error text-white">
Your form's got some errors
</div>
</div>
<% end %>
<%= f.text_field :name, placeholder: "Your first name", class: "input input-bordered w-full max-w-xs my-5" %>
<%= inline_error_for(:name, contact) %>
@dashingspidy
dashingspidy / http_request_spec.rb
Created May 9, 2024 16:35 — forked from timuruski/http_request_spec.rb
Example of a flexible pattern for making HTTP requests with Ruby Net:HTTP
require "json"
require "net/http"
require "uri"
# The standard library Net::HTTP module is a bit convoluted, but here is an example of a flexible
# system for making different kinds of HTTP requests. To see some convenience methods you can
# consult the docs: https://ruby-doc.org/stdlib-2.5.5/libdoc/net/http/rdoc/Net/HTTP.html
class HttpConnection
def get(url, params = nil)
@dashingspidy
dashingspidy / create.html
Created November 24, 2018 11:55 — forked from ianseyer/create.html
Form/Modal/Flask
<script type="text/javascript">
// This identifies your website in the createToken call below
Stripe.setPublishableKey('da_key');
// ...
</script>
<script>
jQuery(function($) {
$('#form').submit(function(event) {
var $form = $(this);
@dashingspidy
dashingspidy / values.py
Created November 24, 2017 07:14
Python predefined value
nationalities = (
('Afghan', gettext('Afghan')),
('Albanian', gettext('Albanian')),
('Algerian', gettext('Algerian')),
('American', gettext('American')),
('Andorran', gettext('Andorran')),
('Angolan', gettext('Angolan')),
('Antiguans', gettext('Antiguans')),
('Argentinean', gettext('Argentinean')),
('Armenian', gettext('Armenian')),
@dashingspidy
dashingspidy / upload-files-with-flask.md
Created November 19, 2017 01:45 — forked from seanbehan/upload-files-with-flask.md
upload files to s3 with flask, PIL and tinys3

HTML form for file uploads

<!-- in templates/form.html -->
<form action="/upload" method="POST" enctype="multipart/form-data">
 <input type="file" name="logo">
 <button>Upload</button>
</form>
@dashingspidy
dashingspidy / nationality.en.yml
Created November 18, 2017 03:08 — forked from pifleo/nationality.en.yml
List of nationalities FR/EN in Yaml (yml)
# List of nationalities taken from Gist and Gem converted to yaml and translated:
# - https://github.com/JomaMinoza/nationality
# - http://www.codegist.net/code/rails-nationality-select/
# - https://gist.github.com/marijn/274449
# - https://gist.github.com/clawfire/5170433 (fr)
#
# Country:
# - https://github.com/stefanpenner/country_select
# - https://github.com/hexorx/countries/
#
@dashingspidy
dashingspidy / NATIONALITIES.py
Created November 7, 2017 18:22 — forked from zamai/NATIONALITIES.py
List of nationalities in python list and tuple format
#List of *hopefuly* all nationalities in list an tuple format for each python copy/paste
NATIONALITIES_tuple = ('Afghan', 'Albanian', 'Algerian', 'American', 'Andorran', 'Angolan', 'Antiguans', 'Argentinean', 'Armenian', 'Australian', 'Austrian', 'Azerbaijani', 'Bahamian', 'Bahraini', 'Bangladeshi', 'Barbadian', 'Barbudans', 'Batswana', 'Belarusian', 'Belgian', 'Belizean', 'Beninese', 'Bhutanese', 'Bolivian', 'Bosnian', 'Brazilian', 'British', 'Bruneian', 'Bulgarian', 'Burkinabe', 'Burmese', 'Burundian', 'Cambodian', 'Cameroonian', 'Canadian', 'Cape Verdean', 'Central African', 'Chadian', 'Chilean', 'Chinese', 'Colombian', 'Comoran', 'Congolese', 'Costa Rican', 'Croatian', 'Cuban', 'Cypriot', 'Czech', 'Danish', 'Djibouti', 'Dominican', 'Dutch', 'Dutchman', 'Dutchwoman', 'East Timorese', 'Ecuadorean', 'Egyptian', 'Emirian', 'Equatorial Guinean', 'Eritrean', 'Estonian', 'Ethiopian', 'Fijian', 'Filipino', 'Finnish', 'French', 'Gabonese', 'Gambian', 'Georgian', 'German', 'Ghanaian', 'Greek', 'Grenadian', 'Guate