Skip to content

Instantly share code, notes, and snippets.

View karson's full-sized avatar
🎯
Focusing

Karson karson

🎯
Focusing
View GitHub Profile
@karson
karson / read-write-file.js
Created September 27, 2015 04:11
Read Write to file with javascript
/// write to file
var txtFile = "c:/test.txt";
var file = new File(txtFile);
var str = "My string of text";
file.open("w"); // open file with write access
file.writeln("First line of text");
file.writeln("Second line of text " + str);
file.write(str);
file.close();
@karson
karson / backup.php
Created February 28, 2017 06:35 — forked from menzerath/backup.php
PHP: Recursively Backup Files & Folders to ZIP-File
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* (c) 2012-2014: Marvin Menzerath - http://menzerath.eu
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit','1024M');
@karson
karson / gsm-setup.md
Created June 11, 2017 17:50 — forked from heyalexej/gsm-setup.md
SIM Card Management Through GSM Modem On Linux

SIM Card Management Over GSM Modem

A small guide on how to send and receive USSD codes on Linux

I am using the built in GSM (UMTS) modem of my Thinkpad X1 extensively because I am often in places with flaky internet connections. I connect through the standard Network Manager on Ubuntu and everything works fine. There was one major annoyance though. Every time I wanted to top up the SIM balance or book a new package, I needed a phone to send and receive USSD codes. So I took some time to figure out how to do it from the shell. I wrote this down as a help for others and a reminder for myself. Without further ado...

First intsall gammu and picocom.

~  sudo apt-get install -y gammu picocom
@karson
karson / .htaccess
Last active August 27, 2018 09:46
redirect https #cpanel #hosting
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example\.com/$1 [R,L]
@karson
karson / comoSerChatoNowhatsapp.js
Created October 18, 2017 15:38 — forked from callmeloureiro/comoSerChatoNoWhatsapp.js
Como fazer alguém te responder no whatsapp
var counter = 0;
var i = setInterval(function(){
window.InputEvent = window.Event || window.InputEvent;
var d = new Date();
var event = new InputEvent('input', {bubbles: true});
var textbox = document.querySelector('#main > footer > div.block-compose > div.input-container > div.pluggable-input.pluggable-input-compose > div.pluggable-input-body.copyable-text.selectable-text');
// Mensagem que será enviada
textbox.textContent = "Me responde!";
@karson
karson / dominio.js
Created October 27, 2017 03:01
bloquear dominios reservados whmcs
/*
Criado por Victor Hugo Scatolon de Souza
CompuLabs.com.br
*/
$(document).ready(function() {
// Aqui você coloca o IP de seus nameservers (OBS.: TEM QUE SER O IP MESMO)
// Você pode colocar vários IP de várias revendas, basta adicionar uma virgula, ex: var meusip = ['127.0.0.1', '192.0.0.1'];
var meusip = ['127.0.0.1'];
// Mensagem mostrada quando o dominio não é permitido
@karson
karson / woo-checkout-fields.php
Created March 7, 2018 15:33 — forked from bavington/woo-checkout-fields.php
Reorder Checkout Fields in WooCommerce
// Reorder Checkout Fields
add_filter('woocommerce_checkout_fields','reorder_woo_fields');
function reorder_woo_fields($fields) {
$fields2['billing']['billing_email'] = $fields['billing']['billing_email'];
$fields2['billing']['billing_first_name'] = $fields['billing']['billing_first_name'];
$fields2['billing']['billing_last_name'] = $fields['billing']['billing_last_name'];
$fields2['billing']['billing_country'] = $fields['billing']['billing_country'];
$fields2['billing']['billing_address_1'] = $fields['billing']['billing_address_1'];
$fields2['billing']['billing_address_2'] = $fields['billing']['billing_address_2'];
@karson
karson / pre-vhost.conf
Created March 10, 2018 16:00
Bloquear xmlrpc wordpress #buteforce
<Files xmlrpc.php>
Order Deny,Allow
Deny from all
</Files>
@karson
karson / desligar-tela.sh
Created March 14, 2018 12:16
Desliga a tela pela linha de comando no #linux #bash
xset dpms force off
@karson
karson / setup-mysql.sh
Created March 15, 2018 18:45 — forked from sheikhwaqas/setup-mysql.sh
Install MySQL Server on Ubuntu (Non-Interactive Installation)
# Download and Install the Latest Updates for the OS
apt-get update && apt-get upgrade -y
# Set the Server Timezone to CST
echo "America/Chicago" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# Enable Ubuntu Firewall and allow SSH & MySQL Ports
ufw enable
ufw allow 22