Skip to content

Instantly share code, notes, and snippets.

View tatocaster's full-sized avatar
🇺🇦

Merab Tato Kutalia tatocaster

🇺🇦
View GitHub Profile
@zkikvidze
zkikvidze / gist:03da6518c5b5774bf27a
Last active August 29, 2015 14:13
bash: parse IP addresses from apache log files
#!/bin/bash
###
# Requires GeoIP package
###
if [ $# -eq 0 ]; then
echo "ფაილი მითითებული არ არის."
echo "მაგალითი: $0 access_log"
echo "მაგალითი 2: $0 -l 40 access_log"
exit 1
@tatocaster
tatocaster / magtifun_sms_terminal.py
Last active April 22, 2016 12:36
magtifun sender from terminal (python)
import urllib,urllib2,cookielib
cookie_jar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie_jar))
urllib2.install_opener(opener)
url_1 = 'http://www.magtifun.ge/index.php?page=11&lang=ge'
values = dict(password='Password', user='User', act='1')
data = urllib.urlencode(values)
req = urllib2.Request(url_1, data)
/*
* numbers.c
*
* Copyleft (C) 2018 Sun Dro (a.k.a. kala13x)
*
* This is the CLI client for nomrebi.com web site.
*/
#include <stdio.h>
#include <stdlib.h>
@itsjavi
itsjavi / bootstrap-equal-height.css
Created June 10, 2014 16:12
Bootstrap 3 responsive equal height columns
/* From: http://www.minimit.com/articles/solutions-tutorials/bootstrap-3-responsive-columns-of-same-height */
/* columns of same height styles */
.container-xs-height {
display:table;
padding-left:0px;
padding-right:0px;
}
.row-xs-height {
display:table-row;
@emmaguy
emmaguy / textcolor-stats.kts
Created February 17, 2020 12:41
Look at all Android layout files and collate what value is set for 'android:textColor' and count the usages of each
val textColorsUsed = mutableMapOf<String, Int>()
File("../").walkTopDown().forEach { file ->
if (file.isFile && file.extension == "xml" && file.path.contains("res/layout")) {
val builder: DocumentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
val xmlInput = InputSource(StringReader(file.readText()))
val doc: Document = builder.parse(xmlInput)
val androidViews = XPathFactory.newInstance()
.newXPath()

ჯანსაღი ქომუნითის წესები

  1. სანამ კითხვას დასვამთ, ჯერ ეცადეთ მოძებნოთ პასუხი თქვენივე ძალებით, 15 წუთი მაინც. მოძებნისთვის შეგიძლიათ გამოიყენოთ სხვადასხვა ონლაინ საძიებო სისტემა, როგორიცაა: google, duckduckgo, stackoverflow ან ამ ტექნოლოგიის დოკუმენტაცია.
  2. კითხვა გასაგებად ჩამოაყალბეთ, ჩანდეს რომ თქვენ უკვე ეცადეთ თქვენით გარკვევა და დაიცავით პირველი წესი და ნამდვილად გჭირდებათ ქომუნითსგან დახმარების მიღება.
    1. მაგალითი გაამარტივეთ და მთელი აპლიცაკიის კოდის მაგივრად, კოდის ის ნაწილი გააშეაროთ, რომელიც კერძოდ ამ პრობლემასთან არის დაკავშირებული. ეს ასევე აჩვენებს, რომ პრობლემა სწორედ გესმით.
    2. არ გააზიაროთ კოდის ფრაგმენტი პოსტში, რადგან facebook-ი ინდენტაციას აშორებს კოდს და დახმარების სურვილით აღჭურვილი პირისთვის რთულად წასაკითხს ხდის.
    3. კოდის გაზიარებისთვის გამოიყენეთ ისეთი პლატფორმები, რომლებიც საშუალებას იძლევა კოდი ვიზუალურად კარგად ჩანდეს (ფორმატირებულად, ფერებით) და თან დაკოპირება ან რედაქტირებაა შესაძლებელი. მაგალითად Gist, codesandbox, jsfiddle, codepen და ა.შ.
@victorloux
victorloux / AppServiceProviders.php
Last active October 12, 2020 10:52
@Dump directive for Blade in Laravel 5
// place the following in app/Providers/AppServiceProviders.php, in the boot() method
/**
* Blade directive to dump a variable/object inside a template.
* This is similar to dd(), except that it doesn't interrupt the
* execution of the app. It does NOT support multiple arguments
* however, you have to use one directive per variable.
*
* @example @dump($posts->comments)
*/
@adamwathan
adamwathan / troubleshooting.md
Last active January 19, 2021 04:14
Troubleshooting Valet on macOS Sierra

Troubleshooting Valet on Sierra

Common Problems

Problem: I just see "It works!"

Apache is running on port 80 and interfering with Valet.

  1. Stop Apache: sudo /usr/sbin/apachectl stop
  2. Restart Valet: valet restart
@bryansills
bryansills / WhiteBalanceAdjuster.kt
Last active July 25, 2021 11:31
Auto White Balance Adjustment
import android.graphics.Bitmap
import android.graphics.Color
import androidx.annotation.ColorInt
import com.curiouscreature.kotlin.math.Float3
import com.curiouscreature.kotlin.math.Mat3
import com.curiouscreature.kotlin.math.saturate
import com.curiouscreature.kotlin.math.transpose
import kotlin.math.pow
@mannodermaus
mannodermaus / LoganSquareConverter.java
Last active September 16, 2021 12:28
LoganSquare Retrofit Converter
package retrofit.converter;
import com.bluelinelabs.logansquare.LoganSquare;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;
import retrofit.converter.ConversionException;
import retrofit.converter.Converter;