Skip to content

Instantly share code, notes, and snippets.

View adamhut's full-sized avatar

Yu Ting Huang adamhut

  • Shapeways
  • Los Angeles
View GitHub Profile
@adamhut
adamhut / FindRiskyNumericFields.php
Created December 14, 2022 14:58 — forked from ilyasozkurt/FindRiskyNumericFields.php
FindRiskyNumericFields.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class FindRiskyFieldsOnDatabases extends Command
{
/**
@adamhut
adamhut / install_php_8_1.sh
Created October 26, 2022 04:10 — forked from DenisJunio/install_php_8_1.sh
Laravel - PHP 8.1 Extensions - Ubuntu
#!/bin/bash
sudo apt install software-properties-common && sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt upgrade -y
sudo apt install php8.1 -y
sudo apt install php8.1-bcmath -y
sudo apt install php8.1-bz2 -y
sudo apt install php8.1-cli -y
sudo apt install php8.1-common -y
sudo apt install php8.1-curl -y
@adamhut
adamhut / MySQL
Created June 29, 2022 18:52 — forked from grimzy/MySQL
Copy database
mysqldump -h <source_host> -u <source_user> <source_db> | mysql -h <destination_host> -u <destination_user> <destination_db>
@adamhut
adamhut / certbot.sh
Created February 10, 2022 05:17 — forked from fideloper/certbot.sh
Certbot on Ubuntu, wildcard subdomains via CloudFlare DNS challenge
# Used on Ubuntu 18.04 and 20.04
# Find instructions for other OSes here: https://certbot.eff.org/instructions
# Install Certbot via Snaps
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
# Install DNS CloudFlare plugin
sudo snap set certbot trust-plugin-with-root=ok
@adamhut
adamhut / publickey-git-error.markdown
Created May 3, 2021 01:47 — forked from adamjohnson/publickey-git-error.markdown
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "your_email@example.com". Th
@adamhut
adamhut / download-file.js
Created March 22, 2021 18:32 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@adamhut
adamhut / History\-100e7a40\entries.json
Last active December 12, 2023 04:10
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///f%3A/code/my-study-note/Server/Logging.md","entries":[{"id":"ofEU.md","timestamp":1682909093793},{"id":"2eZL.md","timestamp":1682909148058},{"id":"BEga.md","source":"renamed.source","timestamp":1682909249754},{"id":"ZUHf.md","timestamp":1682909250564},{"id":"H9Yu.md","timestamp":1682909272732},{"id":"4iWM.md","timestamp":1682909422022}]}
@adamhut
adamhut / RouteDirectives.php
Created January 5, 2020 03:18 — forked from calebporzio/RouteDirectives.php
Blade Route Directives
<?php
// Register these inside a service provider:
Blade::directive('route', function ($expression) {
return "<?php echo route({$expression}) ?>";
});
Blade::directive('routeIs', function ($expression) {
return "<?php if (request()->routeIs({$expression})) : ?>";
@adamhut
adamhut / 刪除AWS RDS Query指令.md
Last active December 11, 2019 18:18
AWS RDS kill a long running query to prevent row level lock

您可以使用 rds_kill 和 rds_kill_query 命令,終止資料庫執行個體上的使用者工作階段或查詢。 首先連接到您的 MySQL 資料庫執行個體,然後發出適當的命令,如下所示。如需詳細資訊,請參閱連接至執行 MySQL 資料庫引擎的資料庫執行個體。

CALL mysql.rds_kill(thread-ID)
CALL mysql.rds_kill_query(thread-ID) 
@adamhut
adamhut / DateInput.vue
Created August 27, 2019 12:39 — forked from reinink/DateInput.vue
Pikaday Vue Component
<template>
<div>
<label v-if="label" class="form-label" :for="`date-input-${_uid}`">{{ label }}:</label>
<input v-bind="$attrs" class="form-input" :id="`date-input-${_uid}`" :class="{ error: error }" type="text" ref="input" :value="value" @change="change" @keyup="change">
<div v-if="error" class="form-error">{{ error }}</div>
</div>
</template>
<script>
import pikaday from 'pikaday'