Skip to content

Instantly share code, notes, and snippets.

View ulkoart's full-sized avatar

Artem Ulko ulkoart

  • Russia, Krasnodar
View GitHub Profile
@subfuzion
subfuzion / curl.md
Last active April 23, 2024 14:44
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.

@eugenebokhan
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
@denji
denji / README.md
Last active April 5, 2024 10:03 — forked from Cubixmeister/README.md
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
*Swift*
// Старая документация от Apple — это золото. Но и актуальной не брезгуй.
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemoryMgmt.html#//apple_ref/doc/uid/10000011i
https://developer.apple.com/library/archive/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011226
// Это вообще Threading Programming Guide, но тут есть о Runloop :)
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Multithreading/Introduction/Introduction.html#//apple_ref/doc/uid/10000057i-CH1-SW1
// Блог Mike Ash-a набирает в полезности со временем
https://www.mikeash.com/pyblog/friday-qa-2017-09-22-swift-4-weak-references.html
@kimus
kimus / cx_oracle.md
Last active January 25, 2024 04:36
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.

Linux

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:

@francoismarceau29
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
}
@chillpop
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]
}
@Highstaker
Highstaker / secondsToText.py
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):
#11-19
return gen_pl
elif s_last_digit == '1':
#1
return nom_sing
elif int(s_last_digit) in range(2,5):
@jmn
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 %}