Skip to content

Instantly share code, notes, and snippets.

@salomvary
salomvary / backup-mysql.yml
Last active February 12, 2025 23:09
GitHub Action for mysqldump
name: backup-mysql
on:
schedule:
# Run at 7:00 UTC every day
- cron: "0 7 * * *"
jobs:
run_mysqldump:
runs-on: ubuntu-latest
steps:
- name: Dump database
@soygul
soygul / youtube-upload.js
Last active June 1, 2025 17:15
YouTube video uploader using JavaScript and Node.js
// YouTube API video uploader using JavaScript/Node.js
// You can find the full visual guide at: https://www.youtube.com/watch?v=gncPwSEzq1s
// You can find the brief written guide at: https://quanticdev.com/articles/automating-my-youtube-uploads-using-nodejs
//
// Upload code is adapted from: https://developers.google.com/youtube/v3/quickstart/nodejs
const fs = require('fs');
const readline = require('readline');
const assert = require('assert')
const {google} = require('googleapis');
@cyrus007
cyrus007 / BLE_UART_SERVER.ino
Created January 9, 2020 21:53
ESP32 BLE server
/*
* "ESP32 BLE Server"
*
* Control RGB LED and two servos using the Android app "Bluetooth Remote".
* 1) create a BLE Device;
* 2) create a BLE Server;
* 3) create a BLE UART Service with one characteristic for TX
* and one for RX using the following UUIDs:
* 6E400001-B5A3-F393-E0A9-E50E24DCCA9E for the Service,
* 6E400002-B5A3-F393-E0A9-E50E24DCCA9E for the TX Characteristic (Property = Notify),
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
#include "BLE2902.h"
#include "BLEHIDDevice.h"
#include "HIDTypes.h"
#include "HIDKeyboardTypes.h"
// See the following for generating UUIDs:
// https://www.uuidgenerator.net/
@KRostyslav
KRostyslav / tsconfig.json
Last active May 19, 2025 05:04
tsconfig.json с комментариями.
// Файл "tsconfig.json":
// - устанавливает корневой каталог проекта TypeScript;
// - выполняет настройку параметров компиляции;
// - устанавливает файлы проекта.
// Присутствие файла "tsconfig.json" в папке указывает TypeScript, что это корневая папка проекта.
// Внутри "tsconfig.json" указываются настройки компилятора TypeScript и корневые файлы проекта.
// Программа компилятора "tsc" ищет файл "tsconfig.json" сначала в папке, где она расположена, затем поднимается выше и ищет в родительских папках согласно их вложенности друг в друга.
// Команда "tsc --project C:\path\to\my\project\folder" берет файл "tsconfig.json" из папки, расположенной по данному пути.
// Файл "tsconfig.json" может быть полностью пустым, тогда компилятор скомпилирует все файлы с настройками заданными по умолчанию.
// Опции компилятора, перечисленные в командной строке перезаписывают собой опции, заданные в файле "tsconfig.json".
@mrmartineau
mrmartineau / stimulus.md
Last active May 16, 2025 13:02
Stimulus cheatsheet
@searsia
searsia / proxy.php
Created January 6, 2018 08:45
Simple PHP image proxy
<?php
$PROXY = 'https://yourdomain.top/proxy.php?url=';
# This script forwards the call
# Check for url parameter, and prevent file transfer
if (isset($_GET['url']) and preg_match('#^https?://#', $_GET['url']) === 1) {
$url .= $_GET['url'];
} else {
@filipstachura
filipstachura / poland_woj.json
Last active February 10, 2025 13:50
GeoJSON with Polish Administrative Areas Boundaries
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stekhn
stekhn / weightedMean.js
Last active September 25, 2024 03:23
Weighted arithmetic mean (average) in JavaScript
function weightedMean(arrValues, arrWeights) {
var result = arrValues.map(function (value, i) {
var weight = arrWeights[i];
var sum = value * weight;
return [sum, weight];
}).reduce(function (p, c) {
@serhiinkh
serhiinkh / nginx
Last active November 21, 2015 23:09
#map $status $loggable {
# ~^[2,3] 0;
# default 1;
#}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name ~^(www\.)?(?<domain>.+?).loc$;