Skip to content

Instantly share code, notes, and snippets.

View kenlog's full-sized avatar
๐Ÿ‘จโ€๐Ÿ’ป
"Hands on!"

Valentino Pesce kenlog

๐Ÿ‘จโ€๐Ÿ’ป
"Hands on!"
View GitHub Profile
@kenlog
kenlog / stripe-keys-and-ids.tsv
Created April 11, 2021 16:39 — forked from fnky/stripe-keys-and-ids.tsv
Stripe keys and IDs
Prefix Description Notes
sk_live_ Live secret key Secret key in a live environment.
pk_live_ Live public key Public key in a live environment.
pst_live_ Live Connection token Connection token in a live environment.
sk_test_ Test secret key Pecret key in a test environment.
pk_test_ Test public key Public key in a test environment.
pst_test_ Test Connection token Connection token in a test environment.
ac_ Platform Client ID Identifier for an auth code/client id.
acct_ Account ID Identifier for an Account object.
ch_ Charge ID Identifier for a Charge object.
@kenlog
kenlog / apache2.sh
Created January 18, 2020 18:08
Clean Apache2 log files via SSH
sudo truncate -s 0 /var/log/apache2/error.log
sudo truncate -s 0 /var/log/apache2/access.log
@kenlog
kenlog / .htaccess
Created January 5, 2020 21:28
Security Headers
<IfModule mod_headers.c>
## CSP
Header set Content-Security-Policy: default-src 'self'; img-src 'self' https://singlepage.it; object-src 'none'; script-src 'self'; style-src 'self'; frame-ancestors 'self'; base-uri 'self'; form-action 'self';
## Security Headers
Header set X-XSS-Protection: 1; mode=block
Header set Access-Control-Allow-Origin: https://www.singlepage.it
Header set X-Frame-Options: deny
Header set X-Content-Type-Options: nosniff
Header set Strict-Transport-Security: max-age=3600; includeSubDomains
@kenlog
kenlog / .htaccess
Created January 5, 2020 21:28
Security Headers
<IfModule mod_headers.c>
## CSP
Header set Content-Security-Policy: default-src 'self'; img-src 'self' https://singlepage.it; object-src 'none'; script-src 'self'; style-src 'self'; frame-ancestors 'self'; base-uri 'self'; form-action 'self';
## Security Headers
Header set X-XSS-Protection: 1; mode=block
Header set Access-Control-Allow-Origin: https://www.singlepage.it
Header set X-Frame-Options: deny
Header set X-Content-Type-Options: nosniff
Header set Strict-Transport-Security: max-age=3600; includeSubDomains
@kenlog
kenlog / command.bash
Created December 26, 2019 22:41
Show your branch name on your terminal
sudo nano ~/.bashrc
force_color_prompt=yes
color_prompt=yes
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
else
@kenlog
kenlog / terminal.bash
Created December 26, 2019 22:18
Color Git Terminal
git config --global color.ui true
sudo nano ~/.gitconfig
[color]
ui = auto
[color "branch"]
local = yellow
current = yellow reverse
remote = green
@kenlog
kenlog / ImageCompression.php
Last active January 18, 2020 18:27
Image compression with PHP
<?php
$dir = "img/tmp/";
$images_array = glob($dir.'*.jpg');
foreach ($images_array as $image) {
$img = new Imagick();
$img->readImage($image);
$img->setImageCompression(Imagick::COMPRESSION_JPEG);
@kenlog
kenlog / Variables
Created April 9, 2019 08:25
Prestashop 1.7 Smarty Global Variables
{$urls|@var_dump} -> Contains Prestashop urls;
{$shop|@var_dump} -> Contains shop variables (shop name, email, phone, etc...);
{$page|@var_dump} -> Contains current page variables;
{$currency|@var_dump} -> Currency variables;
{$language|@var_dump} -> Language variables;
{$customer|@var_dump} -> Customer variables;
{$configuration|@var_dump} -> Configuration variables;
{$link|@var_dump} -> Link variables;
{$breadcrumb|@var_dump} -> Breadcrumb variables;
{$currency.name} -> Name of the active currency.
@kenlog
kenlog / Info
Created October 29, 2018 10:16 — forked from Cumquat/Info
Basic encryption on Silverstripe
*****************
*The Data Object*
*****************
<?php
class TheData extends DataObject {
public static $db = array(
'Name' => 'Varchar',
'SecretData' => 'Varchar'
@kenlog
kenlog / EmailPage.php
Created July 17, 2018 11:05 — forked from frankmullenger/EmailPage.php
Simple GPG encryption test
<?php
class EmailPage extends Page {
}
class EmailPage_Controller extends Page_Controller {
private static $allowed_actions = array(
'Form'
);