Skip to content

Instantly share code, notes, and snippets.

View heitara's full-sized avatar
💻
Swift & SwiftUI

Emil Atanasov heitara

💻
Swift & SwiftUI
View GitHub Profile
@heitara
heitara / sed.md
Last active April 12, 2024 20:41
Useful sed commands for macOS

Here are some useful sed commands for file editing

sed 10q demo.txt - prints first 10 lines

sed -i'.bak' 's/hello/bar/' demo.txt - replace the first "hello" on each line with "bar"

sed -i'.bak' 's/hello/bar/g' demo.txt - replace the ALL "hello" on each line with "bar"

sed -i'.bak' '3d' demo.txt - remove the 3rd line in a file

@heitara
heitara / resotre-dmg-to-sdcard.md
Last active March 15, 2024 12:39
How to restor dmg (copy of FAT sdcard) to a new sdcard

How to restore an image (.dmg) to a sdcard?

The image you want to use when recovering should be crated earlier. The sdcard should be empty or the data on it will be lost.

First, the image should be converted to a pure image. This can be dane with the following command:

hdiutil convert sdcard_image.dmg -format UDTO -o sdcard_pure_image.img
@heitara
heitara / mkcert-README.md
Last active January 31, 2022 14:09
How to fix problems with mkcert

If you face any problems like missig keystore

" keytool error: java.lang.Exception: Keystore file does not exist: "

You have to create a default keystore in your JAVA_HOME.

JAVA_HOME/jre/lib/security/cacerts cacerts default password is changeit. This file is important and should be secured. You can read more here

Once that's done you should be able to use mkcert.

//this is jsut the "meat" of the solution
const PEPPERFLASH_PLUGIN = 'resources/pepperFlash/mac/PepperFlashPlayer.plugin'
let pluginName
let pluginDir = __dirname
switch (process.platform) {
case 'win32':
switch (process.arch) {
case "x64":
pluginName = PEPPERFLASH_PLUGIN_WIN64
break;
{
"asarUnpack" : ["resources/pepperFlash/mac"]
}
@heitara
heitara / electron.pepper.flash.index.js
Last active July 31, 2020 23:47
How to load properly PepperFlash in Electron on Mac
//this is jsut the "meat" of the solution
const PEPPERFLASH_PLUGIN = __dirname.indexOf("asar") >=0 ? '../resources/pepperFlash/mac/PepperFlashPlayer.plugin' : 'resources/pepperFlash/mac/PepperFlashPlayer.plugin'
let pluginName
switch (process.platform) {
case 'win32':
switch (process.arch) {
case "x64":
pluginName = PEPPERFLASH_PLUGIN_WIN64
break;
default:
@heitara
heitara / numbertotext-bg.js
Last active June 2, 2020 16:28
Number to text, number to words, Словом, Число в текст на български
let toBGN = (value) => {
let under10 = (value, currency = false) => {
let index = Math.floor(value)
if(index > 10) {
index = 10;
}
let resultArray =
[
"нула", "един", "два", "три", "четири", "пет", "шест",
@heitara
heitara / imagemagick.shell.sh
Created May 3, 2020 07:56
Image Magick resize buch of images
#!/bin/bash
FILES=*.jpg
mkdir out
for f in $FILES
do
echo "Processing $f file..."
# take action on each file. $f store current file name
convert $f -resize 2000x2000\> out/$f
done
@heitara
heitara / ImageMagick.Watermark.bat
Created May 3, 2020 07:55
Image Magick resize and manipulate files on Windows
REM add watermark to all JPG images in the same folder
REM resize all JPG images in the same folder
REM put the result in different folder
SET IMAGE_MAGICK="C:\Program Files\ImageMagick-7.0.10-Q16\magick.exe"
SET SIZE=700x700
mkdir watermark
mkdir resize
for /F "usebackq delims=" %%i in (`dir /a:-d /b %foldername%\*.jpg`) do %IMAGE_MAGICK% %%i ( watermark.png ) -gravity center -composite watermark\%%i