Skip to content

Instantly share code, notes, and snippets.

View sychedelix's full-sized avatar
🎯
Focusing!

Hicham Abdelkaoui sychedelix

🎯
Focusing!
View GitHub Profile
@sychedelix
sychedelix / lemp-stack-server-setup-and-wordpress-mgiration.md
Created January 10, 2023 16:42
LEMP Stack Server Setup & WordPress Migration

LEMP Stack Server Setup & WordPress Migration

LEMP Stack Server Setup

Context: LEMP on Ubuntu 20.04 LTS VPS by Vultr.

Initial SSH

  1. If SSH is denied, use the noVNC Console via Vultr; Login; Wait for the full setup to finish;
@sychedelix
sychedelix / intercom-launcher.html
Last active November 7, 2022 08:48
Intercom Launcher
<script>
window.intercomSettings = {
api_base: "https://api-iam.intercom.io",
app_id: "{{your_intercom_id}}"
};
</script>
<script>
// We pre-filled your app ID in the widget URL: 'https://widget.intercom.io/widget/b648dc4o'
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/b648dc4o';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
#!/bin/sh
## Add it to the startup (Mint Linux in my case)
## Delay it by 100 seconds and only use it if you have space issues
rm -rf ~/.cache/spotify/Data/
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="pay-this@email.com">
<input type="hidden" name="item_name" value="Donation">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="9.00">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="AU">
#!/bin/bash
for file in ./*.csv; do
tmp=${file#"./"}
campaing=${tmp%".csv"}
sed -i -e 's/^/'$campaing', /' $file
sed '1d' $file | sponge $file
awk 'BEGIN {OFS=FS=",";} {temp=$NF; $NF = ""; sub(",$", ""); print temp, $0}' $file >> output/binded-data.csv
@sychedelix
sychedelix / force-ssl-wp-config.php
Created February 25, 2019 09:39
Froce SSL with Cloudflare via wp-config.php
/** Force SSL */
// Keep this up there just after <?php to avoid issues
define('FORCE_SSL_ADMIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
@sychedelix
sychedelix / batch-events-amplitude-node.js
Last active May 18, 2022 05:57
Send batch events to Amplitude via their HTTP batch API from a JSON events file.
const fetch = require('node-fetch');
const fs = require("fs");
var args = process.argv.slice(2);
var api_key = "my api key"; // Production - with great power comes great responsibility
// Limitations: 20MB and 2000 events /request
var events = fs.readFileSync(args[0], 'utf8');
@sychedelix
sychedelix / avito-ma-zapier-alert.js
Created December 6, 2018 20:39
Zapier Code to get alerts on a spesific search in Avito.ma
// Avito API: https://s2dar.blogspot.com/2015/02/api-non-officielle-avito.html
// Tip: make sure to add a filter before you add an action to receive the notification via email or other...
var query = "google pixel 3";
const url = "https://www.avito.ma/lij?fullad=1&q="+query+"&w=112&ca=5_s&cg=5000&st=s";
fetch(url)
.then(function(res) {
return res.json();
@sychedelix
sychedelix / zap-amplitude-tag.js
Created December 6, 2018 20:30
Zapier Code: Amplitude Identify HTTP Post
var api_url = "https://api.amplitude.com/httpapi?";
var api_key = "my project api key";
var event_url = encodeURI(api_url+'event=[{"user_id":"'+inputData.email+'", "event_type":"$identify", "user_properties":{ "$set": {"[CRM] Qualification Status":"'+inputData.sales_status+'", "[CRM] Sales Pipline": "'+inputData.sales_pipline+'"} }, "time":'+inputData.modification_time+'}]&api_key='+api_key);
const res = await fetch(event_url, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",