Skip to content

Instantly share code, notes, and snippets.

View lajlev's full-sized avatar

Michael Lajlev lajlev

View GitHub Profile
@lajlev
lajlev / espanso-password-expander.me
Last active October 21, 2021 06:10
Use Espanso as password expander
## Steps
1. Add password to keychain (Screenshot: https://u.lillefar.dk/q2BI5m)
2. Add snippet to espanso config file (default.yml) where some-password i identical to account name for your keychain.
```
- triggers: [":pass:"]
replace: "{{output}}"
vars:
- name: output
@lajlev
lajlev / worktree-publish-to-gh-pages.md
Created March 23, 2020 11:48 — forked from ErickPetru/worktree-publish-to-gh-pages.md
Publishing a `dist` folder from `master` branch using **worktree** feature to `gh-pages` branch.

Setup

First of all, you need to have a gh-pages. If you don't have, create:

git branch gh-pages

This makes a branch based on the master HEAD. It would be okay but the files and the git history of master branch are not meaningful on gh-pages branch.

@lajlev
lajlev / iconMonster.js
Created November 30, 2018 09:28 — forked from illmat/iconMonster.js
Doesn't actually download anything, but saves all svgs from Iconmonstr by grabbing each inline svg from the preview box. If you like the Icons please consider to make a donation for the iconmostr wesbite - http://iconmonstr.com/
var casper = require('casper').create();
var fs = require('fs');
var pages = [];
casper.start('http://iconmonstr.com/page/2', function () {
var pageNumbers = this.evaluate(function () {
return $('a.page-numbers:nth-child(7)').html();
});
@lajlev
lajlev / create-remove-view-repo.sh
Last active August 24, 2018 10:39
View, create & delete bitbucket repo via Bash function
# Create a Bitbucket repo
function bbcreate () {
if [ $# == 1 ]; then # Passing an parameter?
curl -s -S -X POST --user $BITBUCKET_USER:$BITBUCKET_PASS "https://api.bitbucket.org/2.0/repositories/lajlev/$1" -d "is_private=true" # Create a private repo
git init # Init local git repo
git remote add origin [email protected]:$BITBUCKET_USER/$1.git # Add Bitbucket repo as git remote
printf "\n\n\n 🍄 https://bitbucket.org/$BITBUCKET_USER/$1 created\n\n" # Confirm messsage
else # No parameter
printf "\n Please enter a repo name 👍\n\n"
fi
@lajlev
lajlev / bitbucket.sh
Last active February 14, 2017 08:15
Bitbucket bash commands
function bbcreate(){
curl -s -S -X POST -v -u lajlev:$BITBUCKET_PASS -H "Content-Type: application/json" \
https://api.bitbucket.org/2.0/repositories/lajlev/$1 \
-d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks" }' > /dev/null
printf "\n 🍄 https://bitbucket.org/lajlev/$1 created\n\n"
}
function bbdelete(){
read -r -p "Delete https://bitbucket.org/lajlev/$1 ? [y/N] " response
response=${response,,}
#!/bin/sh
# Requires sketch and Sketchtool
# Q: How to enable it?
# A: Add it to your repo pre-commit hook
# Q: What does it do?
# A: It creates a .exportArtboards folder with all artboards as PNGs,
# so you easily can see changes in GIT 🎊.
@lajlev
lajlev / slack_slash-command_frokost-dk.php
Created May 25, 2016 12:07
A Slack - slash command for frokost.dk
<?php
// Create a new slack slash command https://my.slack.com/services/new/slash-commands
header('Content-Type: application/json; charset=utf-8');
# Grab token from the slash command.
$token = $_POST['token'];
# Check the token and make sure the request is from our team
@lajlev
lajlev / foo.bash
Last active August 29, 2015 14:28
Bulk convert images to grayscale
for i in *.jpg; do convert $i -colorspace Gray gray/$i; done
@lajlev
lajlev / .bash_function
Created May 14, 2015 13:52
WP-CLI create bash function
wp-create() {
wp core download
git init
gi wordpress >> .gitignore
mysql -uroot -proot -e "create database $1;"
wp core config --dbname=$1 --dbuser=root --dbpass=root
wp core install --url=http://$1.wp --title=$1 --admin_user=lajlev --admin_password=7913 [email protected]
}
@lajlev
lajlev / ebert.rb
Created December 16, 2014 09:09
How do I capitalize the words?
#!/usr/bin/ruby
tmp = "{query}"
# If there was a query, then parse the query
unless tmp.nil? || tmp == 0
args = tmp.split
num = args.at(0)
char_limit = args.at(1)
else