Skip to content

Instantly share code, notes, and snippets.

@rseon
rseon / cheatsheet.md
Last active December 28, 2023 18:27
Prestashop cheatsheet (>= 1.5)

Prestashop 1.7 cheatsheet

The most common. For me. Mostly from comments in source code.

Updated with 1.7 code.

Address

/**
@BrightSoul
BrightSoul / Invocazione webservice sogei
Created May 13, 2018 12:27
Invocazione webservice sogei
static void Main(string[] args)
{
var address = new EndpointAddress(new Uri("https://url-del-servizio-sogei"));
var binding = CreateMultiFactorAuthenticationBinding();
ServicePointManager.ServerCertificateValidationCallback = ValidateCallback;
var factory = new ChannelFactory<NomeInterfacciaProxyClient>(binding, address);
var certificate = new X509Certificate2(@"percorso.pfx", "password");
factory.Credentials.ClientCertificate.Certificate = certificate;
factory.Endpoint.Contract.ProtectionLevel = ProtectionLevel.Sign;
@phpdreams
phpdreams / rebuild-cache.php
Created April 28, 2018 00:17
Speaker List Cache Generation
<?php
// this will read in all the speakers, sort them by date, then store in a file for use later
$speakerList = [
'speaker-file',
];
$speakers_all = [];
foreach($speakerList as $speaker) {
$speakers_all[$speaker] = include_once("./speakers/{$speaker}.php");
$speakers_all[$speaker]['bullet-points'] = text2bullets($speakers_all[$speaker]['bullet-points']);
@levelsio
levelsio / btc-eth-dca-buy.php
Last active January 6, 2023 22:04
This script runs daily and "Dollar Cost Average"-buys $40 BTC and $10 ETH per day
<?
//
// [ BUY BTC & ETH DAILY ON BITSTAMP ]
// by @levelsio
//
// 2017-08-23
//
// 1) buy $40/day BTC
// 2) buy $10/day ETH
//
@paragonie-scott
paragonie-scott / rsa-encrypt.php
Created December 12, 2016 04:50
RSA Limits Demo
<?php
$publicKey = openssl_pkey_get_public('
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7o9A47JuO3wgZ/lbOIOs
Xc6cVSiCMsrglvORM/54StFRvcrxMi7OjXD6FX5fQpUOQYZfIOFZZMs6kmNXk8xO
hgTmdMJcBWolQ85acfAdWpTpCW29YMvXNARUDb8uJKAApsISnttyCnbvp7zYMdQm
HiTG/+bYaegSXzV3YN+Ej+ZcocubUpLp8Rpzz+xmXep3BrjBycAE9z2IrrV2rlwg
TTxU/B8xmvMsToBQpAbe+Cv130tEHsyW4UL9KZY1M9R+UHFPPmORjBKxSZvjJ1mS
UbUYN6PmMry35wCaFCfQoyTDUxBfxTGYqjaveQv4sxx0uvoiLXHt9cAm5Q8KJ+8d
@ezimuel
ezimuel / sign.sh
Created March 14, 2016 15:50
Sign and verify a file using OpenSSL command line tool. It exports the digital signature in Base64 format.
#!/bin/bash
# Sign a file with a private key using OpenSSL
# Encode the signature in Base64 format
#
# Usage: sign <file> <private_key>
#
# NOTE: to generate a public/private key use the following commands:
#
# openssl genrsa -aes128 -passout pass:<passphrase> -out private.pem 2048
# openssl rsa -in private.pem -passin pass:<passphrase> -pubout -out public.pem
@michalczukm
michalczukm / Atom_export_settings.md
Last active September 23, 2023 12:32
Atom: Backup all settings

Export:

  1. Copy from ${user}/.atom:
  • config.cson
  • keymap.cson
  • snippets.cson
  • styles.less
  1. Save installed packages list apm list --installed --bare > packages.list
@joashp
joashp / openssl_encrypt_decrypt.php
Created September 4, 2015 15:59
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@matchaxnb
matchaxnb / regenerate-images.php
Created May 20, 2015 14:56
Regenerate images in Prestashop from command line
<?php
define('_PS_ROOT_DIR_', '/path/to/prestashop/root');
define('_PS_ADMIN_DIR_', _PS_ROOT_DIR_.'admin_folder');
require(_PS_ADMIN_DIR_.'/../config/config.inc.php');
require(_PS_ADMIN_DIR_.'/functions.php');
class Employee2 extends EmployeeCore
{
public function isSuperAdmin()
@zcshiner
zcshiner / UbuntuMiner
Last active March 11, 2019 11:56
UbuntuMiner. Command list to build an Ubuntu 14.04 Server with Cuda Toolkit 6.5, driver 352.41, and ccminer.
#!/bin/bash
### Command log to install Cuda Toolkit 6.5, driver 343.22, and ccminer.
## Update the system
sudo apt-get update && sudo apt-get -y dist-upgrade
# All the dependencies for Cuda & ccminer (I think)
sudo apt-get -y install gcc g++ build-essential automake linux-headers-$(uname -r) git gawk libcurl4-openssl-dev libjansson-dev xorg libc++-dev libgmp-dev python-dev