Skip to content

Instantly share code, notes, and snippets.

View Tegos's full-sized avatar
🐼

Ivan Mykhavko Tegos

🐼
View GitHub Profile
@amalmurali47
amalmurali47 / backup_digitalocean.md
Last active November 7, 2024 13:03
Backup DigitalOcean droplet locally

DigitalOcean does not provide a way to download a snapshot of your droplet locally. You can use rsync to accomplish this instead.

On your local machine, assuming you have added your-server in your SSH config:

rsync -aAXHv --append-verify --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} your-server:/
  • -a : archive mode (all files, with permissions, etc.)
  • -A : preserve ACLs/permissions (not included with -a)
@kenberkeley
kenberkeley / config.yml
Last active July 12, 2022 04:01
The simplest CircleCI 2.1 config example for Node / JS projects
## References:
# https://git.io/Jf3l9
# https://circleci.com/docs/2.0/yarn/
# https://circleci.com/docs/2.0/caching/#yarn-node
# https://circleci.com/orbs/registry/orb/circleci/node
# https://discuss.circleci.com/t/circleci-2-1-config-overview/26057
version: 2.1
orbs:
node: circleci/[email protected]
@ervinne13
ervinne13 / Laravel Auto Increment Reset
Last active March 29, 2022 09:47
Laravel reset auto increment for tests with databases where you can't do a migrate:refresh
<?php
namespace <Your namespace here>;
use Illuminate\Support\Facades\DB;
/**
*
* @author Ervinne Sodusta <[email protected]>
*/
@Razoxane
Razoxane / laravel_conditional_index_migration.php
Created August 8, 2017 01:35
Laravel - Create Index If Not Exists / Drop Index If Exists
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class LaravelConditionalIndexMigration extends Migration
{
/**
* Run the migrations.
@fevangelou
fevangelou / my.cnf
Last active November 18, 2024 10:13
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated September 2024 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@antonioribeiro
antonioribeiro / gist:6f7a4c9a1336f798fa65
Last active March 9, 2022 05:20
Add more conditions to your Laravel Relations
public function connections()
{
	$relation = $this
		->belongsToMany(static::class, 'connections', 'requestor_id', 'requested_id')
		->withTimestamps();

	/// delete the already built inner join
	$relation
		->getQuery() // Eloquent\Builder
@devdattaT
devdattaT / getTiles.py
Created July 14, 2014 08:31
Downloading of Slippy Tiles using Shapely.
import math
import os
import urllib
from shapely.geometry import Polygon
def deg2num(lat_deg, lon_deg, zoom):
lat_rad = math.radians(lat_deg)
n = 2.0 ** zoom
xtile = int((lon_deg + 180.0) / 360.0 * n)
ytile = int((1.0 - math.log(math.tan(lat_rad) + (1 / math.cos(lat_rad))) / math.pi) / 2.0 * n)
@rxaviers
rxaviers / gist:7360908
Last active November 19, 2024 04:20
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@codedokode
codedokode / Задача на калькулятор.md
Created October 16, 2013 10:54
Задание на калькулятор и ООП

Задача про калькулятор на ООП

  • Уровень: джуниор с широким кругозором и целеустремленностью
  • Ключевые слова для гугления подсказок: грамматики, токенайзер, парсер, recursive descent, обратная польская запись, AST
  • Время: 2-3 дня

Ты можешь использовать любой понравившийся язык и библиотеки, но, пожалуйста, не ищи готовые решения и не копипасть код (можно найти решение на другом языке, разобраться, как оно работает, и написать своими словами, если сам додуматься не смог). Гуглить и использовать алгоритмы можно.

Задание: сделать программу-калькулятор, считающую значение математического выражения. Выражение содержит целые (123) и дробные числа (13.45), скобки, операции +, -, /, *, ^ (возведение в степень). В выражении должен соблюдаться приоритет операций: