Skip to content

Instantly share code, notes, and snippets.

@salomvary
salomvary / backup-mysql.yml
Last active February 8, 2024 19:33
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
@KRostyslav
KRostyslav / tsconfig.json
Last active May 6, 2024 06:54
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 April 19, 2024 09:41
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 July 29, 2022 21:24
GeoJSON with Polish Administrative Areas Boundaries
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 November 20, 2022 03:49
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$;
@swiftgeek
swiftgeek / iButtonRW.ino
Last active November 1, 2023 04:18
RW1990 programmer, with arduino
// Based on https://danman.eu/blog/cloning-ibutton-using-rw1990-and-avr/
// and: http://elimelecsarduinoprojects.blogspot.com/2013/06/read-dallas-ibutton-arduino.html
// By Swift Geek 28-08-2015
// TODO: danger to atmega328! Use OpenCollector logic!
// Used 4.8kΩ Pull-up and 3.1 Vcc for arduino/pull-up
#include <OneWire.h>
OneWire ibutton (8); // I button connected on PIN 2.
@xesscorp
xesscorp / esp8266.ino
Last active December 7, 2021 17:06
This program issues commands to an ESP8266 Wifi module in order to receive an HTML page from a website.
///////////////////////////////////////////////////////////////////////////////////////
// This program uses the ESP8266 Wifi module to access a webpage. It's an adaptation of
// the program discussed at http://hackaday.io/project/3072/instructions
// and shown here http://dunarbin.com/esp8266/retroBrowser.ino .
//
// This program was ported to the ZPUino 2.0, a softcore processor that runs on an FPGA
// and emulates an Arduino.
//
// This program works with version 00160901 of the ESP8266 firmware.
///////////////////////////////////////////////////////////////////////////////////////
@jmas
jmas / Arr.js
Last active August 29, 2015 14:06
Array extended with methods .on(), .trigger(), .walk() and throw event "change" when array is mutated
var
arrayPop = Array.prototype.pop,
arrayPush = Array.prototype.push,
arrayReverse = Array.prototype.reverse,
arrayShift = Array.prototype.shift,
arraySort = Array.prototype.sort,
arraySplice = Array.prototype.splice,
arrayUnshift = Array.prototype.unshift;
var Arr = function() {