Skip to content

Instantly share code, notes, and snippets.

View PurwadiPw's full-sized avatar
👶
MistakeMaker

Purwadi PurwadiPw

👶
MistakeMaker
View GitHub Profile
@madrussa
madrussa / example-model.js
Last active January 27, 2021 07:44
Adonis v4 Multi Tenancy Example
'use strict'
/** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */
const Model = use('Model')
class ExampleModel extends Model {
/**
* Add traits
*/
static boot () {
# Install dependencies
brew install wget autoconf openssl libjpeg libpng lzlib curl imap-uw readline postgresql libxml2 mcrypt gettext libxslt libiconv icu4c expat bison webp freetype mongodb-community
# Dirs
mkdir -p /Applications/MAMP/bin/php/php7.4.2/include
cd /Applications/MAMP/bin/php/php7.4.2/include
# Download PHP 7.4.2 sources
wget http://fr2.php.net/get/php-7.4.2.tar.bz2/from/this/mirror -O php-7.4.2.tar.bz2
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active April 30, 2026 05:09
crack activate Office on mac with license file
@rhukster
rhukster / sphp.sh
Last active January 6, 2026 10:00
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
@moeiscool
moeiscool / ffmpegToWeb.js
Last active April 4, 2025 10:37
FLV Live Stream to Web Page with flv.js, FFMPEG, and Express Web Server (Node.js)
// Shinobi (http://shinobi.video) - FFMPEG FLV over HTTP Test
// How to Use
// 1. Navigate to directory where this file is.
// 2. Run `npm install express`
// 3. Start with `node ffmpegToWeb.js`
// 4. Get the IP address of the computer where you did step 1. Example : 127.0.0.1
// 5. Open `http://127.0.0.1:8001/` in your browser.
var child = require('child_process');
var events = require('events');
@labbots
labbots / SwitchPhp.sh
Last active April 5, 2023 18:01
Bash script to switch between available PHP versions in Ubuntu. (Tested in Ubuntu 16.04)
#!/bin/bash
# Check if ran with root permissions
if [ `id -u` -ne 0 ]; then
printf "The script must be run as root! (you can use sudo)\n"
exit 1
fi
function arrayContains {
local e match="$1"
@nshtg
nshtg / mysql-docker.sh
Last active April 10, 2025 03:00 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE > backup.sql
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | gzip > backup.sql.gz
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | bzip2 > backup.sql.bz2
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
gunzip < backup.sql.gz | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
bunzip2 < backup.sql.bz2 | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
@Azoy
Azoy / install-swift-ubuntu.md
Last active December 9, 2022 03:42
Guide on how to install Swift on Ubuntu

Install Swift on Ubuntu

Requirements

  1. Ubuntu 14.04, 16.04, or 16.10

Step 1 - Dependencies

  1. Open up terminal
  2. Install core deps: sudo apt-get install clang libicu-dev git

Step 1.1 - Ubuntu 14.04 Clang

@jbanety
jbanety / build_pcntl.sh
Last active February 6, 2024 02:50
(Updated) Build PCNTL ext for MAMP PHP 7.4.2
#!/bin/bash
PHP_VERSION=7.4.2
# Command lines tools
xcode-select --install
# Install dependencies
brew install wget autoconf openssl lzlib curl imap-uw readline postgresql gettext libxslt libiconv bison pkg-config krb5 bzip2 openldap tidy-html5
# Dirs
@vielhuber
vielhuber / script.sh
Last active January 27, 2026 15:29
PostgreSQL: Backup and restore export import pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux