This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bubble_sort = (arr) => { | |
const n = arr.length; | |
for (let i = 0; i < n; i++) { | |
for (let j = 0; j < n - i - 1; j++) { | |
if (arr[j] > arr[j + 1]) { | |
[arr[j], arr[j + 1]] = [arr[j + 1], arr[j]]; | |
} | |
} | |
} | |
return arr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fibo = n => { | |
if (n <= 1) { | |
return n; | |
} | |
else { | |
return fibo(n-1) + fibo(n-2); | |
} | |
} | |
for (let n of process.argv.slice(2)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
printf 'This is \e[4:3mmono undercurl\e[0m,\n' | |
printf 'and this is \e[4:3m\e[58:2:206:64:51mcolor undercurl\e[0m.\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import binascii | |
import hashlib | |
import hmac | |
import json | |
from time import time | |
def _to_b64url(data): | |
return ( | |
binascii.b2a_base64(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MIT License | |
# | |
# Copyright (c) 2023 Miguel Grinberg | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the prefix to ^A. | |
unbind C-b | |
set -g prefix ^A | |
bind a send-prefix | |
# Start windows and panes at 1, not 0 | |
set -g base-index 1 | |
set -g pane-base-index 1 | |
set -g renumber-windows on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" plugins | |
let need_to_install_plugins = 0 | |
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
let need_to_install_plugins = 1 | |
endif | |
call plug#begin() | |
Plug 'tpope/vim-sensible' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DHT22_PIN = 4 # D2 pin / GPIO4 | |
LED_PIN = 2 # D4 pin / GPIO2 | |
WIFI_ESSID = 'your-wifi-network-name' | |
WIFI_PASSWORD = 'your-wifi-password' | |
INTERVAL = 5 * 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Before you run this script make sure Flask-SQLAlchemy is installed in | |
# your virtual environment | |
from flask import Flask | |
from flask_sqlalchemy import SQLAlchemy | |
app = Flask(__name__) | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' # in-memory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" plugins | |
set nocompatible | |
filetype off | |
let need_to_install_plugins=0 | |
if empty(system("grep lazy_load ~/.vim/bundle/vundle/autoload/vundle.vim")) | |
echo "Installing Vundle..." | |
echo "" | |
silent !mkdir -p ~/.vim/bundle | |
silent !rm -rf ~/.vim/bundle/vundle | |
silent !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle |
NewerOlder