Skip to content

Instantly share code, notes, and snippets.

@AidasK
AidasK / HowToDeleteAllCloudflareRecors.md
Last active April 26, 2024 12:19
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 / .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 / 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 / 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 / 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 / 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 / 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 / order-by.js
Last active December 29, 2015 17:19
angular multi sort/order directive, allows sub-ordering with shift click.Works without jquery.
/*global angular */
angular.module('app.directives').directive('appOrderByInit', function () {
return {
scope: true,
controller: ['$scope', '$parse', '$attrs', function ($scope, $parse, $attrs) {
var defaultOrder = $parse($attrs.appOrderDefault)($scope) || [];
/**
* @name $appOrderBy
*/
@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 / README.txt
Created August 3, 2012 08:43 — forked from i-scorpion/README.txt
Twitter bootstrap fixed table header using jQuery
Here is a simple jQuery plugin to make a table header fixed on top when window is scrolled.
Using the code from twitter bootstrap documentation page, this code is customized for table header.
Create the table with following layout -
<table class="table-fixed-header">
<thead class="header">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>