Skip to content

Instantly share code, notes, and snippets.

@yudapc
yudapc / Mining ETH with GPU
Last active February 18, 2024 15:36
Mining ETH
Mining ETH with GPU
Check gpu:
Minimum Ram of GPU is 4GB
Command:
# nvidia-smi
Download packages:
# wget https://github.com/Lolliedieb/lolMiner-releases/releases/download/1.84/lolMiner_v1.84_Lin64.tar.gz
# tar -xvf lolMiner_v1.84_Lin64.tar.gz
@yudapc
yudapc / Certbot Generate Certificate Using Docker
Last active April 30, 2023 17:22
Certbot Generate Certificate Using Docker
docker-compose run certbot certonly -d example.com --manual --preferred-challenges dns --dry-run
@yudapc
yudapc / wp-admin-select2.php
Created November 30, 2022 02:28 — forked from yanknudtskov/wp-admin-select2.php
Add select2 to all select fields in WordPress Admin
<?php
function enqueue_select2_jquery() {
wp_register_style( 'select2css', '//cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.css', false, '1.0', 'all' );
wp_register_script( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.js', array( 'jquery' ), '1.0', true );
wp_enqueue_style( 'select2css' );
wp_enqueue_script( 'select2' );
}
add_action( 'admin_enqueue_scripts', 'enqueue_select2_jquery' );
@yudapc
yudapc / disable-native-login.php
Created November 9, 2022 02:01 — forked from gene1wood/disable-native-login.php
Disable Wordpress native username password login when using Google Apps Login
<?php
/**
* Plugin Name: Disable Native Login
* Plugin URI: https://cs.cementhorizon.com/
* Description: Disable the native username password login in wordpress
* Version: 1.0.0
* Author: Gene Wood
* Author URI: https://cs.cementhorizon.com/
* License: GPL2
@yudapc
yudapc / Kubernetes
Created August 22, 2022 15:09
Kubernetes
Kubernetes
Create secret:
kubectl create secret generic <secret-name> --from-literal=username=<username> --from-literal=username=<password> --from-literal=address=<ip-address>
Create Deployment:
kubectl create deployment <deployment-name> --image <docker-image-name> --dry-run=client -o yaml > deployment.yaml
Create Service:
kubectl expose deployment <deployment-name> --type LoadBalancer --port 80 --dry-run=client -o yaml > loadbalancer.yml
@yudapc
yudapc / mysql-docker.sh
Created June 12, 2022 11:30 — 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 --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
// Object to query string
params = { keyword: 'test', startDate: '20-02-2022' };
urlParams = new URLSearchParams(params).toString(); //"keyword=test&startDate=20-02-2022"
// Query string to Object
search = "keyword=test&startDate=20-02-2022"
queryParams = new URLSearchParams(search)
getParams = Object.fromEntries(queryParams);
@yudapc
yudapc / Remove all file .snap
Last active February 11, 2022 02:19
Remove all file .snap
### Remove all file .snap
rm $(find . -name "*.snap")
### File .htaccess force https
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond $1 !^(index\.php|resources|robots\.txt|public)
@yudapc
yudapc / Install update WordPress puglins directly.md
Created December 15, 2021 07:20 — forked from dianjuar/Install update WordPress puglins directly.md
Install update WordPress plugins without providing ftp access

Install WordPress plugins directly (without FTP)

Put this on your wp-config.php

/* That's all, stop editing! Happy blogging. */
define('FS_METHOD', 'direct');
@yudapc
yudapc / gist:697c2c6c692f72a66a83b1f9862bb330
Created June 7, 2021 12:54
MacOS Software Productivity
Spectacle
Copyclip2
VsCode
Chrome
LastPass
Tunnelblick
Homebrew