Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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>
@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 / 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 / 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 / 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 / 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 / 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 / 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;)