Skip to content

Instantly share code, notes, and snippets.

View davigmacode's full-sized avatar

Irfan Vigma Taufik davigmacode

View GitHub Profile
@davigmacode
davigmacode / image.tsx
Created July 6, 2023 03:08
React get blob from loaded image
<img
crossOrigin="anonymous"
onLoad={(e) => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
ctx?.drawImage(e.currentTarget, 0, 0);
canvas.toBlob((blob) => blob && doSomeThing(blob));
}}
/>
@davigmacode
davigmacode / mint_from_metaplex_master.sh
Created October 2, 2021 00:33 — forked from benchow/mint_from_metaplex_master.sh
How to use Metaplex to mint a lot of NFTs from a master edition
#!/bin/bash
########################
# Instructions
#
# Download Metaplex code
# - git clone git@github.com:metaplex-foundation/metaplex.git
#
# Edit webserver code to be able to mint NFT
# - In file .env, add your wallet address that will mint the NFTs to here => REACT_APP_STORE_OWNER_ADDRESS_ADDRESS=<Wallet Address>
import 'package:flutter/material.dart';
class GoogleMapsClonePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
CustomGoogleMap(),
CustomHeader(),
@davigmacode
davigmacode / docker-compose.yml
Created March 7, 2018 02:19
Docker Elasticsearch
version: '2'
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.1
container_name: elasticsearch1
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms4g -Xmx4g"
ulimits:
@davigmacode
davigmacode / gist:d09ae6bb9d10325b2e1813585a0f6fb5
Created January 20, 2018 05:24
add new user ubuntu and setup ssh keys
// Log in to your server as the root user.
local$ ssh root@server_ip_address
// Use the adduser command to add a new user to your system.
// Be sure to replace username with the user that you want to create.
# adduser username
// Set and confirm the new user's password at the prompt. A strong password is highly recommended!
Set password prompts:
Enter new UNIX password:
@davigmacode
davigmacode / gh-pages-deploy.md
Created February 14, 2017 13:41 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@davigmacode
davigmacode / agent.cmd
Created August 16, 2016 02:22 — forked from Shoozza/agent.cmd
Make Cmder work with ssh-agent
@ECHO OFF
REM Set default sock file
SET SSH_AUTH_SOCK=/tmp/ssh-agent.sock
REM Check socket is available
IF NOT EXIST "%TMP%\ssh-agent.sock" GOTO:RUNAGENT
REM Check if an ssh-agent is running
FOR /f "tokens=*" %%I IN ('ps ^| grep ssh-agent ^| sed "s/^ *\([0-9]\+\) .*/\1/"') DO SET VAR=%%I
@davigmacode
davigmacode / tableinfo.php
Created April 28, 2016 08:00
Aplikasi sederhana untuk menampilkan informasi table dalam sebuah database, dan menyimpannya menjadi file .doc. Sangat berguna untuk seseorang yang sedang mengerjakan TA/Skripsi, untuk menampilkan daftar tabel pada draft TA/Skripsi
<?php
$databases = array();
$tables = array();
$posted = new stdClass;
$posted->server = filled_or($_POST['server']);
$posted->username = filled_or($_POST['username']);
$posted->password = filled_or($_POST['password']);
$posted->database = filled_or($_POST['database']);
$posted->action = filled_or($_POST['action']);
@davigmacode
davigmacode / mysql-backup-all.sh
Created April 28, 2016 00:30 — forked from Thinkscape/mysql-backup-all.sh
Backup all mysql databases to separate archives, each table in separate file.
#!/bin/bash
#
# Backup all databases to separate archives.
# 1. Each table is dumped into separate *.sql file.
# 2. Each view is dumped into separate file with DEFINER=CURRENT_USER.
# 3. All routines are dumped into routines-dbname.sql,
# 4. All files are added to archive dbname.7z, compressed with 7-zip, max compression.
#
# Usage: mysqlback.sh /output/directory
#
@davigmacode
davigmacode / dump.sh
Created April 28, 2016 00:28 — forked from andsens/dump.sh
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others