Skip to content

Instantly share code, notes, and snippets.

@AidasK
AidasK / .git-config
Created April 2, 2024 12:47
Working with multiple github users on different projects
// .git/config file example, update each project
[remote "origin"]
url = git@gitlab.com-CUSTOMUSER:repo-namespace/reponame.git
fetch = +refs/heads/*:refs/remotes/origin/*
@AidasK
AidasK / sublimetext-keybindings.json
Created August 16, 2023 13:01
IntelliJ IDEA/PHPStorm MacOS keybindings for SublimeText
[
{ "keys": ["super+d"], "command": "duplicate_line" },
{ "keys": ["super+delete"], "command": "delete_line" },
{ "keys": ["shift+alt+up"], "command": "swap_line_up" },
{ "keys": ["shift+alt+down"], "command": "swap_line_down" },
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol", "extend": false} }
]
@AidasK
AidasK / HowToDeleteAllCloudflareRecors.md
Last active March 16, 2024 20:43
Cloudflare delete all DNS records. Just go to cloudflare dns zones, open your browers developer console and paste this javascript code.

image

Real developers are not used to clicking, it's allways easier to write a script to do it for you.
@AidasK
AidasK / Coordinates.php
Created March 1, 2020 13:47
PHP coords calculation
class Coordinates
{
/**
* @param array $c1 Expected [lat, lon] EPSG:4326
* @param array $c2 Expected [lat, lon] EPSG:4326
* @return float|int distance in meters
*/
public function calculateDistance($c1, $c2)
{
@AidasK
AidasK / README.md
Last active November 2, 2023 07:10
Automatic update of CloudFlare IP addresses in nginx

This script is a copy of https://marekbosman.com/site/automatic-update-of-cloudflare-ip-addresses-in-nginx/

How to use?

wget https://gist.githubusercontent.com/AidasK/27aa5d6f918eca12d95427178b5aaa59/raw/e3ce185de43d89c237e081d3f56e5a79024b4115/cloudflare-update-ip-ranges.sh -P /usr/local/bin/
chmod +x /usr/local/bin/cloudflare-update-ip-ranges.sh

add include /etc/nginx/cloudflare; this line to /etc/nginx/nginx.conf (above include /etc/nginx/conf.d/*.conf;)

@AidasK
AidasK / gist:301b4231c0792bd4542c
Last active February 5, 2017 15:25
Daiktu sarasas kelionems
[ ]Pasai
[ ]pinigai
[ ]draudimas
[ ]EU draudimo korteles
[ ]credit card
[ ]sutartys
[ ]pinigine
Rubai
[ ]termo apatiniai
@AidasK
AidasK / utf8unixnobom
Last active December 28, 2015 08:15
Convert file to UTF8 without bom and with UNIX line endings. Usage: `utf8unixnobom ./* -e=iso-8859-1`
#!/bin/bash
for arg in $*
do
if [[ $arg =~ ^\-e\=.* ]]; then
force=${arg:3}
echo "FORCE $force"
fi
done;
for file in $*
@AidasK
AidasK / artisan
Last active April 8, 2019 10:11
docker nginx-proxy installation guide
#!/bin/bash
DIR=$(basename `pwd` | tr "[:upper:]" "[:lower:]")
CONTAINER="${DIR}""_php_1"
# support for whitespace in arg list
CSMOPTS=()
whitespace="[[:space:]]"
for i in "$@"
do
@AidasK
AidasK / eks.py
Created May 21, 2015 20:52
100mb parallel upload to dropbox and drive
#!/usr/bin/python -u
"""
Dropbox File Transfer Comparison - POC
This program compares the speed of uploading multiple files to dropbox using
both queued and parallel connections per file.
"""
import time
@AidasK
AidasK / 100mb files
Last active August 29, 2015 14:18
Drop box parallel upload and sequence upload analysis
Uploading 2 files of size 104857600
in sequence time taken (seconds): 54.40421
in parallel time taken (seconds): 46.30641
Uploading 4 files of size 104857600
in sequence time taken (seconds): 109.19875
in parallel time taken (seconds): 81.90215
Uploading 8 files of size 104857600
in sequence time taken (seconds): 227.43679
in parallel time taken (seconds): 154.61778