Skip to content

Instantly share code, notes, and snippets.

View ulkoart's full-sized avatar

Artem Ulko ulkoart

  • Russia, Krasnodar
View GitHub Profile
// Старая документация от Apple — это золото. Но и актуальной не брезгуй.
// Это вообще Threading Programming Guide, но тут есть о Runloop :)
// Блог Mike Ash-a набирает в полезности со временем
eugenebokhan / CGImage+Resize.swift
Last active April 11, 2024 21:28
UIImage + Resize
import CoreGraphics
import Accelerate
import CoreImage
import UIKit
extension CGImage {
public enum Error: Swift.Error {
case imageResizingFailed
case cgContextCreationFailed
francoismarceau29 / UIImage+CVPixelBuffer.swift
Created September 9, 2017 00:08
UIImage to CVPixelBuffer
import UIKit
extension UIImage {
func toCVPixelBuffer() -> CVPixelBuffer? {
let attrs = [kCVPixelBufferCGImageCompatibilityKey: kCFBooleanTrue, kCVPixelBufferCGBitmapContextCompatibilityKey: kCFBooleanTrue] as CFDictionary
var pixelBuffer : CVPixelBuffer?
let status = CVPixelBufferCreate(kCFAllocatorDefault, Int(self.size.width), Int(self.size.height), kCVPixelFormatType_32ARGB, attrs, &pixelBuffer)
guard status == kCVReturnSuccess else {
return nil
jmn / django_pagination_bootstrap4
Created August 28, 2017 00:55
Django pagination controls for Bootstrap 4
{% if is_paginated %}
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-left">
{% if page_obj.has_previous %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">&laquo;</a></li>
{% else %}
<li class="page-item disabled"><a class="page-link" href="#"><span>&laquo;</span></a></li>
{% endif %}
{% for i in paginator.page_range %}
{% if page_obj.number == i %}
denji /
Last active May 16, 2024 10:38 — forked from Cubixmeister/
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
Highstaker /
Last active January 5, 2021 02:51
secondsToText with pluralization (days, hours, minutes, seconds) in several languages: English, German, Spanish and Russian.
def pluralizeRussian(number, nom_sing, gen_sing, gen_pl):
s_last_digit = str(number)[-1]
if int(str(number)[-2:]) in range(11,20):
return gen_pl
elif s_last_digit == '1':
return nom_sing
elif int(s_last_digit) in range(2,5):
subfuzion /
Last active June 20, 2024 13:48
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

chillpop / Dictionary+Enum.swift
Last active August 8, 2022 10:12
swift Dictionary subscript with String enum
protocol StringEnum {
var rawValue: String { get }
extension Dictionary {
subscript(enumKey: StringEnum) -> Value? {
get {
if let key = enumKey.rawValue as? Key {
return self[key]
kimus /
Last active June 1, 2024 13:32
Installing python cx_oracle on Ubuntu

First of all, it just seems like doing anything with Oracle is obnoxiously painful for no good reason. It's the nature of the beast I suppose. cx_oracle is a python module that allows you to connect to an Oracle Database and issue queries, inserts, updates..usual jazz.


Step 1:

sudo apt-get install build-essential unzip python-dev libaio-dev

Step 2. Click here to download the appropriate zip files required for this. You'll need: