Skip to content

Instantly share code, notes, and snippets.

View imvaskii's full-sized avatar
🎯
Focusing

Bhaskar imvaskii

🎯
Focusing
View GitHub Profile
@imvaskii
imvaskii / docker-compose.yml
Created March 14, 2019 15:40
Docker Compose file for portainer.
version: '3.5'
services:
portainer:
image: portainer/portainer
ports:
- "9000:9000"
command: -H unix:///var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@imvaskii
imvaskii / import_export_gz.sql
Created March 5, 2019 04:05 — forked from rakeshtembhurne/import_export_gz.sql
MySQL: Import and export in gzip form
// Export database in gzip form
mysqldump -u user -p database | gzip > database.sql.gz
// Import database from gzip form
gunzip < database.sql.gz | mysql -u user -p database
@imvaskii
imvaskii / Keybase.md
Created February 26, 2019 12:35
Keybase

Keybase proof

I hereby claim:

  • I am bhaskarkc on github.
  • I am bhaskarkc (https://keybase.io/bhaskarkc) on keybase.
  • I have a public key ASAXUNkkU8LLKt3UTTozMPl-WwHayMVT66Cl-eD6g1IPZgo

To claim this, I am signing this object:

@imvaskii
imvaskii / pass.md
Created February 26, 2019 09:15 — forked from abtrout/pass.md
Using password-store with git repository synching

Password-store keeps your passwords (or any other sensitive information) saved in GnuPG encrypted files organized in ~/.password-store. For more information about GPG, consult the GNU Privacy Handbook.

Getting started

To get started, install pass and generate a keypair.

$ brew install pass
$ gpg --gen-key
$ gpg --list-keys
@imvaskii
imvaskii / array_keys_exists.php
Last active February 12, 2019 00:12
Check array key exists for multiple keys.
<?php
/**
*
* Check if in array for multiple keys and return index
* else return false.
*
* @return mixed|boolean
**/
public function array_keys_exists( array $needles, array $haystack ) {
foreach ( $needles as $needle ) {
@imvaskii
imvaskii / init.vim
Created February 11, 2019 04:25 — forked from danmikita/init.vim
File preview with FZF, RG, Bat, and Devicons
nnoremap <silent> <leader>e :call Fzf_dev()<CR>
" ripgrep
if executable('rg')
let $FZF_DEFAULT_COMMAND = 'rg --files --hidden --follow --glob "!.git/*"'
set grepprg=rg\ --vimgrep
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0)
endif
" Files + devicons
@imvaskii
imvaskii / s3_path_fixer.php
Last active February 7, 2019 23:20
S3 file path fixer.
<?php
/**
* Migrate local image to S3 Bucket
*
* @author Bhaskar K C
*/
$time_start = microtime( true );
// Load WP
@imvaskii
imvaskii / dynamic-upstreams.sh
Last active January 27, 2019 09:31
Dynamically bulid nginx.conf #jq #nginx
#!/bin/bash
upstream_json="upstream-servers.json"
if [ ! -f $upstream_json ]; then
echo "$upstream_json does not exists"
return
exit "$@"
fi
@imvaskii
imvaskii / toCamelCase.php
Last active January 2, 2019 00:26
Convert string to camelCase.
<?php
/**
* Convert string to camelCased format.
*
* supports strings with "-" dash case
*
* @param string $str
* @param boolean $capitalise_first_char
*
* @return string $str camelCased string.
@imvaskii
imvaskii / bash-colors.md
Created November 19, 2018 03:00 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple