Skip to content

Instantly share code, notes, and snippets.

View DaskiOFF's full-sized avatar

Roman Kotov DaskiOFF

View GitHub Profile
@DaskiOFF
DaskiOFF / web-servers.md
Created April 5, 2021 14:53 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@DaskiOFF
DaskiOFF / script-template.sh
Created January 17, 2021 05:12 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@DaskiOFF
DaskiOFF / RKDevice.swift
Last active November 20, 2020 20:54
Apple UIDevice model list. Lightweight. Updated 20.11.2020
import UIKit
fileprivate var __appDeviceSizeModel: UIDevice.DeviceSizeModel?
extension UIDevice {
public enum DeviceSizeModel {
case unknown
case iPhone4
case iPhone5
case iPhone6
case iPhone6Plus

Homebrew Formula for a Go app

These are quick notes from making my own Formula and Tap.

Add go build script to your Git repo

gobuild.sh

#!/bin/bash
import Foundation
extension String {
/// Получить цвет согласно hexa значению описаному в строке
///
/// - Returns: UIColor
func hexaColor() -> UIColor {
return UIColor.hexaStringColor(self)
}
@DaskiOFF
DaskiOFF / gist:1c672b6e5231b91aba75d8d555856544
Created September 21, 2017 14:08 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@DaskiOFF
DaskiOFF / Semaphore.swift
Created May 16, 2017 15:51 — forked from JadenGeller/Semaphore.swift
Swift 2.3 Semaphore
struct Semaphore {
let semaphore: dispatch_semaphore_t
init(value: Int = 0) {
semaphore = dispatch_semaphore_create(value)
}
// Blocks the thread until the semaphore is free and returns true
// or until the timeout passes and returns false
@DaskiOFF
DaskiOFF / uiimageChangeColor.swift
Created February 15, 2017 10:12
Покрасить template картинку для кнопки в другой цвет
import UIKit
extension UIImage {
func changeColor(with color: UIColor) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(self.size, false, UIScreen.main.scale)
let context = UIGraphicsGetCurrentContext()
context?.translateBy(x: 0, y: self.size.height)
context?.scaleBy(x: 1.0, y: -1.0)