Skip to content

Instantly share code, notes, and snippets.

View amos-kibet's full-sized avatar
💭
Nyiganet

Amos Kibet amos-kibet

💭
Nyiganet
View GitHub Profile
@amos-kibet
amos-kibet / Playground.hs
Created May 8, 2022 07:14
Plutus Playground Smart Contract
-- A game with two players. Player 1 thinks of a secret word
-- and uses its hash, and the game validator script, to lock
-- some funds (the prize) in a pay-to-script transaction output.
-- Player 2 guesses the word by attempting to spend the transaction
-- output. If the guess is correct, the validator script releases the funds.
-- If it isn't, the funds stay locked.
import Control.Monad (void)
import Data.ByteString.Char8 qualified as C
import Data.Map (Map)
import Data.Map qualified as Map
@amos-kibet
amos-kibet / Ecto.Changeset.md
Last active October 16, 2022 14:10
Elixir Ecto Changeset Quick Overview

Ecto Changesets Crash Course

  • In order to insert, update or delete data from the database, Ecto.Repo.insert/2, update/2 and delete/2 require a changeset as their first parameter
  • Changesets validate data before being inserted to the database by checking for potential errors, asserting that required fields are passed, asserting that non-empty fields have data, keeping track of changes in the data (think of it as a version control for database transactions), etc

Empty Changeset

iex> %Ecto.Changeset{}
%Ecto.Changeset<action: nil, changes: %{}, errors: [], data: nil, valid?: false>
@amos-kibet
amos-kibet / python_mysql.py
Created July 25, 2022 08:44 — forked from bradtraversy/python_mysql.py
Python & MySQL crash course for beginners
import mysql.connector
from mysql.connector import errorcode
config = {
'user': 'root',
'password': '',
'host': 'localhost',
'database': 'acme'
}
@amos-kibet
amos-kibet / randomizer.ex
Created July 29, 2022 07:20 — forked from ahmadshah/randomizer.ex
Random string in elixir
defmodule Randomizer do
@moduledoc """
Random string generator module.
"""
@doc """
Generate random string based on the given legth. It is also possible to generate certain type of randomise string using the options below:
* :all - generate alphanumeric random string
* :alpha - generate nom-numeric random string
@amos-kibet
amos-kibet / gist:f155814ef3ed2c8eb6fe8da7e3a9926a
Created August 12, 2022 06:56 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@amos-kibet
amos-kibet / mern-server-setup.md
Created November 7, 2022 15:22 — forked from sankaire/mern-server-setup.md
Setup Ubuntu & Deploy MERN app

Linux Server Setup & MERN App Deployment

These are the steps to setup an Ubuntu server from scratch and deploy a MERN app with the PM2 process manager and Nginx. We are using Linode, but you could just as well use a different cloud provider or your own machine or VM.

Create an account at Linode

Click on Create Linode

Choose your server options (OS, region, etc)

SSH Keys

@amos-kibet
amos-kibet / nextjs-deploy.md
Created November 8, 2022 11:26 — forked from jjcodes78/nextjs-deploy.md
Deploying NEXTJS site with nginx + pm2

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

@amos-kibet
amos-kibet / default HTTP
Created November 8, 2022 11:33 — forked from iam-hussain/default HTTP
Serve nextJS app from a port through NGINX reverse proxy HTTP and HTTPS
# Serve nextJS app from a port through NGINX reverse proxy (HTTP)
# Path: /etc/nginx/sites-available/default
# Default server configuration for HTTP
server {
server_name www.DOMAINNAME.com DOMAINNAME.com;
# Serve any static assets with NGINX
location /_next/static {
alias /home/ubuntu/PROJECT_FOLDER/.next/static;
@amos-kibet
amos-kibet / stripe-credit-card-numbers.md
Created May 29, 2023 14:17 — forked from rymawby/stripe-credit-card-numbers.md
Stripe test credit card numbers for use in development

#Test credit card numbers to use when developing with Stripe

4242424242424242 Visa

4012888888881881 Visa

4000056655665556 Visa (debit)

@amos-kibet
amos-kibet / vs-code-settings-backup
Created September 12, 2023 03:47
VS Code Settings Backup
{
"workbench.iconTheme": "vscode-icons",
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"workbench.colorCustomizations": {
"editorWhitespace.foreground": "#fbff00",
"workbench.colorTheme": "Monokai Vibrant",
"workbench.activityBar.visible": true,
"workbench.iconTheme": "vscode-icons"
},