Skip to content

Instantly share code, notes, and snippets.

View taivu's full-sized avatar

Tai taivu

View GitHub Profile
@taivu
taivu / dnsmasq.md
Created August 5, 2019 13:42
cw dnsmasq setup

install the stuff

brew update
brew install dnsmasq
brew tap caskroom/cask
brew cask install virtualbox
brew cask install vagrant
brew cleanup
@taivu
taivu / pre-push
Created August 2, 2019 20:45 — forked from kalpeshsingh/pre-push
A pre-push git hook that notify Amazon Chime group
#!/bin/sh
branch="$(git rev-parse --abbrev-ref HEAD)"
# get computer name to append in Chime message
username=$USER
# a branch name where you want to prevent git push. In this case, it's "master"
if [ "$branch" = "master" ]; then
echo "You can't commit directly to '"${branch}"' branch" # webstorm or intellij will show this as popup
@taivu
taivu / gist:82b263ff780498a5b4cda0b84fa0b8f5
Created June 19, 2019 19:33 — forked from fmfpereira/gist:4186d4e40b09b2b49f2a4c91576be78c
Remove uuid, _core and default_config_hash from Drupal 8.x profile install config files.
sed -i "/^uuid:/d;/^_core:/d;/^ default_config_hash:/d" *
@taivu
taivu / opz_backup.sh
Created May 24, 2019 18:17
Backup OP-Z Files on Mac
#!/bin/sh
rsync -rP /Volumes/OP-Z/* ~/Music/OP-Z/Backups/$(date "+%Y-%m-%d_%H-%M-%S")
@taivu
taivu / songs.md
Created May 14, 2019 18:35 — forked from febuiles/songs.md
Fetching lyrics in Unix

Fetching lyrics in the command line

Objective: Print the lyrics for the current playing song.

How: We'll create a small bash script to do the fetching for us (using curl) and then we'll display it either in the terminal or in our $EDITOR

Get the current song

First we'll need to get the name of the current song and its artist:

@taivu
taivu / crontab
Created April 23, 2019 12:48
Daily DB Backup Cron Job
# crontab -l
@daily /bin/bash ~/cron/db-backup.sh
@taivu
taivu / Drupal Controller Snippets.php
Created April 15, 2019 12:39
Drupal Custom Module Development Snippets
<?php
namespace Drupal\custom_module_name\Controller;
use \Drupal\Core\Controller\ControllerBase;
use \Drupal\Core\Site\Settings;
use Drupal\node\Entity\Node;
class CustomModuleController extends ControllerBase {
private function appLibrary() {
$isSandbox = Settings::get('is_sandbox', FALSE); // if not configured, set as false
@taivu
taivu / Drupal Custom Module Notes
Last active April 15, 2019 12:46
Drupal Custom Module Notes
We couldn’t find that file to show.
@taivu
taivu / app.module.ts
Created January 31, 2019 21:10 — forked from mrgoos/app.module.ts
Intercepting http request/respons in Angular 2. Works from version 2.3.0.
...
...
providers: [
{ provide: Http, useClass: ExtendedHttpService }
]
...
...
@taivu
taivu / Instructions.md
Created January 3, 2019 19:11 — forked from pgilad/Instructions.md
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example