Skip to content

Instantly share code, notes, and snippets.

View tallesairan's full-sized avatar
🏠
Working from home

Talles Airan tallesairan

🏠
Working from home
View GitHub Profile
@tallesairan
tallesairan / gpta.py
Created August 11, 2023 14:20 — forked from NaxAlpha/gpta.py
a custom gpt-like model that is tiny but can also scale context very long
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.backends.cuda as cuda
class NewGELU(nn.Module):
def forward(self, x):
@tallesairan
tallesairan / pythia_1b4_8k.py
Created August 11, 2023 14:19 — forked from NaxAlpha/pythia_1b4_8k.py
Fine-tune Pythia 1.4b model for 8k context window, this script requires at least 40 GB of memory, 15-20 hours of fine-tune is sufficient.
import copy
import torch
import torch.nn.functional as F
import torch.backends.cuda as cuda
from torch.utils.data import DataLoader, IterableDataset
import wandb
from tqdm import tqdm
import bitsandbytes as bnb
@tallesairan
tallesairan / url_slug.php
Created April 15, 2021 19:52 — forked from sgmurphy/url_slug.php
URL Slugs in PHP (with UTF-8 and Transliteration Support)
<?php
/**
* Create a web friendly URL slug from a string.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <[email protected]>
* @copyright Copyright 2012 Sean Murphy. All rights reserved.

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process in replace of username/password, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@tallesairan
tallesairan / deploy-keys.md
Created November 30, 2020 15:19 — forked from holmberd/deploy-keys.md
Setup GitHub repository SSH deploy keys

Setup GitHub repository SSH deploy keys

  1. Create GitHub repository in github and save the SSH repository url

  2. Init git on server in code directory

  • git init
  1. Create SSH keys on the server
  • ssh-keygen -t rsa -b 4096 -C [email protected]
  • Rename the key that doesn't end with .pub to repo-name.deploy.pem
public class ATM
{
private boolean userAuthenticated;
private int currentAccountNumber;
private Screen screen;
private Keypad keypad;
private CashDispenser cashDispenser;
private DepositSlot depositSlot;
private BankDatabase bankDatabase;
@tallesairan
tallesairan / wget.sh
Created March 16, 2020 17:59 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@tallesairan
tallesairan / header_http_status_codes.php
Created March 4, 2020 20:19 — forked from phoenixg/header_http_status_codes.php
PHP header() for sending HTTP status codes
<?php
/*
参考自:
http://darklaunch.com/2010/09/01/http-status-codes-in-php-http-header-response-code-function
http://snipplr.com/view/68099/
*/
function HTTPStatus($num) {
$http = array(
@tallesairan
tallesairan / pmt.js
Created December 23, 2019 11:28 — forked from maarten00/pmt.js
Excel PMT in PHP and JavaScript
/**
* Copy of Excel's PMT function.
* Credit: http://stackoverflow.com/questions/2094967/excel-pmt-function-in-js
*
* @param rate_per_period The interest rate for the loan.
* @param number_of_payments The total number of payments for the loan in months.
* @param present_value The present value, or the total amount that a series of future payments is worth now;
* Also known as the principal.
* @param future_value The future value, or a cash balance you want to attain after the last payment is made.
* If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
<?php
/*
Plugin Name: woocommerce modal variationn
Plugin URI: #
Description: show modal window with product variations after clicking -add to cart-.
Version: 0.1
Author: Maks Buriy
Author URI: mailto:[email protected]
License: GPL2
*/