Skip to content

Instantly share code, notes, and snippets.

View 5iDS's full-sized avatar
💭
@ease with the Source

Max 5iDS

💭
@ease with the Source
View GitHub Profile
@svpino
svpino / llama2.py
Last active January 25, 2024 13:12
Running a fine-tuned Llama 2 model
import torch
import peft
import transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
from huggingface_hub.hf_api import HfFolder
ACCESS_TOKEN = "ENTER YOUR HUGGINGFACE ACCESS TOKEN HERE"
HfFolder.save_token(ACCESS_TOKEN)
@usrflo
usrflo / certbot-cleanup.sh
Last active April 24, 2024 13:37
Remove outdated letsencrypt CSRs, keys and certificates from /etc/letsencrypt
#!/bin/bash
# Remove outdated letsencrypt CSRs, keys and certificates
lesslBasePath=/etc/letsencrypt
keepOldVersions=1
keepOldCsrDays=180
keepOldKeysDays=180
if [ ! -d "$lesslBasePath" ]; then
@nicolabeghin
nicolabeghin / docker.yml
Created March 30, 2021 18:28
Ansible to install docker and docker-compose on AWS Graviton t4a ARM64 instances
---
- name: Docker install
hosts: all
become: yes
tasks:
- name: Install docker-ce (centos) via amazon-linux-extras packages
shell: "amazon-linux-extras install docker -y"
- name: Install dependencies
yum:
@chriseugenerodriguez
chriseugenerodriguez / country-bounds.ts
Last active April 10, 2024 15:00
Google Map Country Bounds Javascript
import { Injectable } from '@angular/core';
@Injectable()
export class POIService {
// LEFT, BOTTOM, RIGHT, TOP
private country_bounding_boxes = [
{'AF': {'Afghanistan': [60.5284298033, 29.318572496, 75.1580277851, 38.4862816432]}},
{'AO': {'Angola': [11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998]}},
{'AL': {'Albania': [19.3044861183, 39.624997667, 21.0200403175, 42.6882473822]}},
{'AE': {'United Arab Emirates': [51.5795186705, 22.4969475367, 56.3968473651, 26.055464179]}},
@Bnaya
Bnaya / fetch-stream-json-parser.ts
Created April 9, 2019 08:24
fetch-stream-json-parser.ts basic code example
// https://github.com/dominictarr/JSONStream
// @ts-ignore
import JSONStream from "JSONStream";
import { Observable } from "rxjs";
class Bla {
public creativesOfChannelV4StreamEndpoint<T=any>(
channel: T,
brandId: string,
@hteumeuleu
hteumeuleu / darkModeHandler.ts
Last active March 30, 2023 14:00
Outlook.com darkModeHandler
import type { ContentHandler } from 'owa-controls-content-handler-base';
import { transformElementForDarkMode } from 'owa-dark-mode-utilities';
import {
ATTR_COLOR,
ATTR_BGCOLOR,
DATA_OG_STYLE_COLOR,
DATA_OG_ATTR_COLOR,
DATA_OG_STYLE_BACKGROUNDCOLOR,
DATA_OG_ATTR_BGCOLOR,
} from 'owa-content-colors-constants';
@TonSDe
TonSDe / ebextension-vhost.yaml
Created November 1, 2018 09:20
AWS Elastic Beanstalk : Enable .htaccess
files:
"/etc/httpd/conf.d/hello.conf":
mode: "000644"
owner: root
group: root
content: |
<VirtualHost *:80>
DocumentRoot /var/app/current
<Directory /var/app/current/>
Options Indexes FollowSymLinks
@ErikThiart
ErikThiart / php-nusoap.php
Created August 1, 2018 09:55
PHP7 nusoap library
<?php
/*
$Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
NuSOAP - Web Services Toolkit for PHP
Copyright (c) 2002 NuSphere Corporation
This library is free software; you can redistribute it and/or
@adriansuter
adriansuter / cert-template.conf
Last active April 17, 2024 11:03
Xampp SSL Certificate Creator for Windows (advanced version of https://shellcreeper.com/how-to-create-valid-ssl-in-localhost-for-xampp/)
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).