Skip to content

Instantly share code, notes, and snippets.

@choyno
choyno / multiple-ssh-keys-git.adoc
Created January 23, 2024 05:39 — forked from alejandro-martin/multiple-ssh-keys-git.adoc
Configure multiple SSH Keys for Git

Use Multiple SSH Keys for Git host websites (Github, Gitlab)

This is guide about how to configure multiple SSH keys for some Git host websites such as Github, Gitlab, among others.

Creating SSH keys

  1. Create SSH directory:

@choyno
choyno / ssh-agent.md
Created January 20, 2024 05:41 — forked from mvneves/ssh-agent.md
"Could not open a connection to your authentication agent"

SSH authentication agent does not automatically start when using it from a remote server. This results in the following error message:

$ git pull
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
$ ssh-add ~/my-ssh-key.pem
Could not open a connection to your authentication agent.

To fix it requires manually starting ssh-agent:

@choyno
choyno / Full Width and Half Width Counter
Last active October 13, 2023 02:36
Full Width and Half Width Counter
Step 1 Import to react Component
```import useFullWidthChecker from '../../../../../hooks/helper/useFullWidthChecker';```
Step 2 Call the Function
``` const { characterCounter } = useFullWidthChecker();```
Step 3 Run Function
``` console.log(characterCounter(:TEXT COUNTER HERRE ));```
@choyno
choyno / gist:03aac8efd0a242f035c9c91da9619acb
Last active December 15, 2022 06:24
THE LIFE OF RAILS 7 using ESBUILD
> BRANCH MAIN : CSS AND BOOSTRAP ONLY
> BRANCH CRUD : FXING JS ISSUE USING HOTWIRE AND STIMULUS WITH CRUS SAMPLE
https://github.com/choyno/rails_7_esbuild_boostrap
> RUN LOCAL
bin/dev
rails db:migrate
rails db:seed
@choyno
choyno / simple-pagination.js
Created March 23, 2021 05:17 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@choyno
choyno / mamp.md
Created November 16, 2020 00:23 — forked from jfloff/mamp.md
How to get MAMP to work with SSL ... Yes really.

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you:

#!/bin/ruby
include HTTParty
fields = []
fields << {"Name" => "rocksoftware22", "Component" => "precise4"}
fields << {"Name" => "rocksoftware", "Component" => "precise5"}
params_hash ={}
params_hash[:Sources] = fields
@choyno
choyno / Dockerfile
Created April 8, 2020 10:00
Dockfile Rails 6
FROM ruby:2.6.0
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
RUN apt-get update -qq && apt-get install -y nodejs
ENV APP_PATH=/wfh-tracker
RUN mkdir $APP_PATH
WORKDIR $APP_PATH
COPY Gemfile "${APP_PATH}/Gemfile"
COPY Gemfile.lock "${APP_PATH}/Gemfile.lock"
@choyno
choyno / AddingNginxPumaToServiceRegistrar
Created June 11, 2019 01:48
Adding Nginx and Puma To Service Registrar
"""" FOR NGINX """"
Create new file for register as service on Amazon Linux2
file path: /usr/lib/systemd/system/nginx.service
----------------------- code start
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target
[Service]
@choyno
choyno / swap_memory
Last active December 22, 2021 05:09
Amazon Linux adding Swap Memory
https://www.photographerstechsupport.com/tutorials/adding-swap-space-ec2-amazon-linux-instance/
https://aws.amazon.com/premiumsupport/knowledge-center/ec2-memory-swap-file/
Here are the steps I took to enable swap space
sudo dd if=/dev/zero of=/swapfile bs=1M count=512
sudo mkswap /swapfile
sudo chmod 600 /swapfile