Skip to content

Instantly share code, notes, and snippets.

@akovardin
akovardin / HOWTODMG.md
Created March 19, 2021 12:13 — forked from jadeatucker/HOWTODMG.md
How to create a "DMG Installer" for Mac OS X

Creating a "DMG installer" for OS X

A DMG Installer is convenient way to provide end-users a simple way to install an application bundle. They are basically a folder with a shortcut to the Applications directory but they can be customized with icons, backgrounds, and layout properties. A DMG file (.dmg) is a Mac OS X Disk Image file and it is used to package files or folders providing compression, encryption, and read-only to the package.

##Creating the DMG file #Disk Utility

@akovardin
akovardin / flutter_driver_async_main.dart
Created October 22, 2020 15:40 — forked from Boehrsi/flutter_driver_async_main.dart
During development I encountered https://github.com/flutter/flutter/issues/41029 and didn't liked the solution with hardcoded waiting times. I'm now waiting for the first frame to be rastered successfully and ignoring errors in the meantime. This works well for my tests and avoids hardcoded timings, which often fail (e.g. on a different machine).
Future<FlutterDriver> setupAndGetDriver() async {
FlutterDriver driver = await FlutterDriver.connect();
var connected = false;
while (!connected) {
try {
await driver.waitUntilFirstFrameRasterized();
connected = true;
} catch (error) {}
}
return driver;
@akovardin
akovardin / DownloadAndSaveAudioFile.swift
Created January 19, 2020 21:20 — forked from UmairSharif99/DownloadAndSaveAudioFile.swift
Function to download audio file from url and save it in documents directory
func downloadAndSaveAudioFile(_ audioFile: String, completion: @escaping (String) -> Void) {
//Create directory if not present
let paths = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.libraryDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)
let documentDirectory = paths.first! as NSString
let soundDirPathString = documentDirectory.appendingPathComponent("Sounds")
do {
try FileManager.default.createDirectory(atPath: soundDirPathString, withIntermediateDirectories: true, attributes:nil)
print("directory created at \(soundDirPathString)")
@akovardin
akovardin / gomake.md
Created September 4, 2019 23:15 — forked from rkravchik/gomake.md
Golang alternatives to makefiles.

Go build tasks utilities

Инструментов мало. Тема сообществом мало проработана. Возможно, makefile всех устраивает.

Первая группа: замена утилиты make:

  • makex понимает уже существующие makefiles.

Вторая группа: разнородные инструменты:

  • goxc в своё время популярный сборщик для кроссплатформенной разработки.
package database
import (
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"go.uber.org/zap"
)
type Config struct {
@akovardin
akovardin / new.sql
Created December 30, 2018 18:42
Databse and user
CREATE ROLE poster WITH LOGIN PASSWORD 'secret';
ALTER ROLE poster CREATEDB;
CREATE DATABASE poster;
GRANT ALL PRIVILEGES ON DATABASE poster TO poster
@akovardin
akovardin / submodules.txt
Created December 17, 2018 23:55
[Git] #git
0. mv a/submodule a/submodule_tmp
1. git submodule deinit -f -- a/submodule
2. rm -rf .git/modules/a/submodule
3. git rm -f a/submodule
# Note: a/submodule (no trailing slash)
# or, if you want to leave it in your working tree and have done step 0
3. git rm --cached a/submodule
3bis mv a/submodule_tmp a/submodule
@akovardin
akovardin / download.go
Created December 11, 2018 21:37
Image Download
func DownloadFile(filepath string, url string) error {
// Get the data
resp, err := http.Get(url)
if err != nil {
return err
}
defer resp.Body.Close()
// Create the file
out, err := os.Create(filepath)
package copy
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
)
@akovardin
akovardin / Makefile
Created October 21, 2018 20:17
Makefile for Go Projects
GOPATH=$(shell pwd)/vendor:$(shell pwd)
GOBIN=$(shell pwd)/bin
GOFILES=$(wildcard *.go)
GONAME=$(shell basename "$(PWD)")
PID=/tmp/go-$(GONAME).pid
build:
@echo "Building $(GOFILES) to ./bin"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -o bin/$(GONAME) $(GOFILES)