Skip to content

Instantly share code, notes, and snippets.

View qutek's full-sized avatar
💻
Working from home

Lafif Astahdziq qutek

💻
Working from home
View GitHub Profile
@qutek
qutek / command.md
Created February 21, 2019 21:15
[Disable Mission Control] Disable mission control / spaces on drag to top of screen #mac

Disable:

defaults write com.apple.dock mcx-expose-disabled -bool TRUE && killall Dock

Enable:

defaults delete com.apple.dock mcx-expose-disabled && killall Dock

@qutek
qutek / readme.md
Created February 21, 2019 22:01
[Move MySQL Data] Move mysql data to another machine

Move mysql to another machine

Old Server

  • Stop mysql server
  • Copy contents of datadir to another location on disk (~/mysqldata/*)
  • Start mysql server again (downtime was 10-15 minutes)
  • compress the data (tar -czvf mysqldata.tar.gz ~/mysqldata)
  • copy the compressed file to new server

New Server

@qutek
qutek / .bash_profile
Created April 16, 2019 18:25
[Custom cd function] Custom bash function to cd in my local server directory with autocomplete
# Use it with `goto project`
goto () {
# cancel if no arguments
if [ -z "$1" ]; then
echo "Mau goto kemana??"
return 0
fi
local UPPER=$(printf "%s" "$1" | tr '[:lower:]' '[:upper:]');
local P_DIR="/Users/qutek/LocalServer/_$UPPER";
@qutek
qutek / webpack.mix.js
Created September 16, 2019 15:31 — forked from kellymears/webpack.mix.js
[Gutenberg Webpack Mix] #gutenberg #mix #js
const mix = require('laravel-mix');
const url = 'http://lab.tinypixel.test';
const app = './src';
const config = './config';
const resources = './resources';
const assets = './resources/assets';
const dist = './dist';
const externals = {
@qutek
qutek / clear-node-modules.sh
Last active March 11, 2021 09:46
[Clear Node Modules] Delete all node_modules directory #bash
#!/bin/bash
#
# This script will remove all node modules
#
# Author: Lafif Astahdziq
# https://lafif.me
#
FOLDER_ROOT=${1:-.} # default to current directory
@qutek
qutek / Steps.md
Created November 29, 2019 09:28
[Install OpenLiteSpeed] Install openlitespeed in mac using Homebrew #server #mac

Install using Homebrew

  • brew tap puleeno/openlitespeed
  • brew install openlitespeed

Directory

  • /usr/local/Cellar/openlitespeed/<version>/

Setup admin password

  • Excute script /usr/local/Cellar/openlitespeed/<version>/admin/misc/admpass.sh
  • Input username and password
@qutek
qutek / .gitlab-ci.yml
Last active February 12, 2024 18:26
[Gitlab CI With Rsync] Auto deploy gitlab CI with rsync
# https://gitlab.com/help/ci/quick_start/README
# https://docs.gitlab.com/ee/ci/introduction/
# https://docs.gitlab.com/ee/ci/yaml/
image: dpolyakov/docker-node-latest-with-rsync:latest
# before_script:
# - apt-get update -qq
# - apt-get install -qq git

Aws Cognito: Custom Auth (Developer Authenticated Identities)

How to get OpenID Token & IdentityId from AWS Cognito?

  • example: using bash (aws cli sdk)
  • example: using php (aws php sdk v3.*)

note

  • you need to add example.com as custom auth provider in aws console (cognito/federated)
@qutek
qutek / iframe.html
Created July 10, 2021 16:02 — forked from cirocosta/iframe.html
Sending messages from child iframe to parent webpage
<!DOCTYPE html>
<html>
<head>
<title>My Iframe</title>
</head>
<body>
<button>Botão</button>
<script type="text/javascript">
@qutek
qutek / export-csv.js
Created July 28, 2021 19:06
Export csv javascript xlsx
const generateCSV = () => {
const wb = XLSX.utils.book_new()
const ws = XLSX.utils.json_to_sheet([{ a: 1, b: 2 }])
XLSX.utils.book_append_sheet(wb, ws, 'test')
XLSX.writeFile(wb, 'test.csv')
}