Skip to content

Instantly share code, notes, and snippets.

@MeLlamoPablo
MeLlamoPablo / nvmlink
Created February 1, 2017 11:34
Creates a symlink to /usr/bin/node after using nvm
@reynaldoeg
reynaldoeg / formValidation.js
Last active April 23, 2024 18:51
Validaciones en javascript para formularios
/*FUNCIONES PARA VALIDAR CAMPOS DE FORMULARIOS
is_null(valor) //Valida que el campo no sea nulo
validateName(name) //Valida que un campo contenga solo letras (como nombre o apellido)
validateZipCode(num) //Valida el formato del Codigo Postal (5 dígitos)
validatePhone(num) //Valida el formato del Telefono (10 dígitos)
validateAge(num) //Valida el formato de la Edad (1 a 99 años)
correct_children //Verifica que el número de hijos sea un número entero entre 1 y 99
@marvhus
marvhus / README.md
Last active April 23, 2024 18:51
Floating Point Precision in x86-64 Assembly

Floating Point Precision in x86-64 Assembly

The lack of precison you get with floating point numbers isn't a language problem, it's a problem with floating point nubers themselves, so it even shows up as low as x86-64 assembly.

The assembly in the file bellow is the code I have written to showcase this.

To compile it you have to do this:

$ nasm floats.asm -o floats.o -f elf64
@ankitsejwal
ankitsejwal / save-github-credentials.md
Last active April 23, 2024 18:50
How to save username and password in git

Save credentials:

$ git config credential.helper store
$ git pull

#provide user-name and password and those details will be remembered later. The credentials are stored in the disk, with the disk permissions.

if you want to change password later:

$ git config credential.helper store 
@LongJohnCoder
LongJohnCoder / crt.cpp
Created March 31, 2018 21:53 — forked from mmozeiko/crt.cpp
MSVC CRT startup
#include <windows.h>
extern "C"
{
#pragma section(".CRT$XIA",long,read)
#pragma section(".CRT$XIZ",long,read)
#pragma section(".CRT$XCA",long,read)
#pragma section(".CRT$XCZ",long,read)
#pragma section(".CRT$XPA",long,read)
#pragma section(".CRT$XPZ",long,read)
@ZipFile
ZipFile / README.md
Last active April 23, 2024 18:48
Pixiv OAuth Flow

Retrieving Auth Token

  1. Run the command:

    python pixiv_auth.py login

    This will open the browser with Pixiv login page.

@emxsys
emxsys / wget_google_drive_download.md
Last active April 23, 2024 18:47
Download Google Drive files with WGET

How to download files from Google Drive with WGET

Step 1. Get the ID of the file to download

  1. Get a shareable link from Google Drive by right-clicking the file and selecting Get Shareable Link.

  2. Examine the link to get the file's ID. Example:

    https://docs.google.com/open?id=[ID]

Step 2. Download the file with WGET

  1. Build the download URL using the ID obtained in Step 1. Example:
[
"1185030898148724777",
"956131521733984287",
"956097947727179806",
"1185045871478448242",
"932096380879667253",
"956246550152118374",
"928549000431407164",
"976786710836944936",
"956128945227567145",
@mudge
mudge / eventemitter.js
Last active April 23, 2024 18:46
A very simple EventEmitter in pure JavaScript (suitable for both node.js and browsers).
/* Polyfill indexOf. */
var indexOf;
if (typeof Array.prototype.indexOf === 'function') {
indexOf = function (haystack, needle) {
return haystack.indexOf(needle);
};
} else {
indexOf = function (haystack, needle) {
var i = 0, length = haystack.length, idx = -1, found = false;
@bgusach
bgusach / multireplace.py
Last active April 23, 2024 18:46
Python string multireplacement
def multireplace(string, replacements, ignore_case=False):
"""
Given a string and a replacement map, it returns the replaced string.
:param str string: string to execute replacements on
:param dict replacements: replacement dictionary {value to find: value to replace}
:param bool ignore_case: whether the match should be case insensitive
:rtype: str
"""