Skip to content

Instantly share code, notes, and snippets.

@Hadryan
Hadryan / opcache.ini
Created August 13, 2022 10:36 — forked from rohankhudedev/opcache.ini
Best Zend OpCache Settings / Tuning / Configurations
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=1
; The OPcache shared memory storage size.
opcache.memory_consumption=512
@Hadryan
Hadryan / getSpotifyAccessToken
Created March 21, 2022 12:22 — forked from ahallora/getSpotifyAccessToken
Get Spotify Access Token (client credentials) with PHP and cURL
<?php
$client_id = '<insert your spotify app client id>';
$client_secret = '<insert your spotify app client secret>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://accounts.spotify.com/api/token' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, 'grant_type=client_credentials' );
@Hadryan
Hadryan / ContributorCommunity.adoc
Created December 24, 2021 13:57 — forked from tekiegirl/ContributorCommunity.adoc
Initial tests for the Contributor Community graph

Contributor Community Graph

Developers using Neo4j are currently working alone when they should be working together, but they don’t know who is working on the same technologies. This graph aims to solve this by linking developers with similar interests, projects and events.

Setup of known data

@Hadryan
Hadryan / collaborative_query.sql
Created December 23, 2021 21:26 — forked from daviddyball/collaborative_query.sql
Song Recommendations using Neo4J and Collaborative Filtering
// Example Query
PROFILE
MATCH (user:User {id: 2})-[:LIKES]->(liked_song)<-[:LIKES]-(similar_user)-[:LIKES]->(recommendation)
WITH similar_user, COUNT(similar_user) as similar_user_rating, user
ORDER BY similar_user_rating
LIMIT 50
MATCH (similar_user)-[:LIKES]->(recommendation)
WHERE user<>similar_user AND
Vazir|Vazir.zip|https://github.com/rastikerdar/vazir-font/archive/master.zip|"A Persian (Farsi) Font"|
Samim|Samim.zip|https://github.com/rastikerdar/samim-font/archive/master.zip|"A Persian (Farsi) Font"|
Tanha|Tanha.zip|https://github.com/rastikerdar/tanha-font/archive/master.zip|"A Persian (Farsi) Font"|
Vazir-code|Vazir-code.zip|https://github.com/rastikerdar/vazir-code-font/archive/master.zip|"A Persian (Farsi) Font"|
Awesome|Awesome.zip|https://github.com/rastikerdar/awesome-persian/archive/master.zip|"A Persian (Farsi) Font"|
Shabnam|Shabnam.zip|https://github.com/rastikerdar/shabnam-font/archive/master.zip|"A Persian (Farsi) Font"|
Gandom|Gandom.zip|https://github.com/rastikerdar/gandom-font/archive/master.zip|"A Persian (Farsi) Font"|
Sahel|Sahel.zip|https://github.com/rastikerdar/sahel-font/archive/master.zip|"A Persian (Farsi) Font"|
Parastoo|Parastoo.zip|https://github.com/rastikerdar/parastoo-font/archive/master.zip|"A Persian (Farsi) Font"|
Mirza|Mirza.zip|https://github.com/rastikerdar/mirza-fo
@Hadryan
Hadryan / ffmpeg.md
Created June 10, 2021 06:22 — forked from protrolium/ffmpeg.md
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

<?php
# PHP - low level AES 256 crypt/decrypt using openssl
# compatible with 'openssl enc' format
#
# Key: 32
# IV : 16
#
# Padding: PKCS7 (operated by openssl)
# EVP_BytesToKey: SHA256
@Hadryan
Hadryan / ChecksumGen.java
Created May 21, 2021 12:07 — forked from siddharth/ChecksumGen.java
Replicating / Implementing Java's AES/CBC/PKCS5Padding encryption in PHP
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Base64;
import java.io.ByteArrayOutputStream;
@Hadryan
Hadryan / AesStringEncryptor.java
Created May 21, 2021 12:06 — forked from thiamteck/AesStringEncryptor.java
OpenSSL equivalent for AES encryption with and without PBKDF2 and key-obtention iteration (-iter)
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;
import java.util.Arrays;
import java.util.Base64;
@Hadryan
Hadryan / Crypto.scala
Created May 21, 2021 11:52 — forked from mardambey/Crypto.scala
AES/PKCS5 - encrypted with Perl::CBC and decrypted in Scala/Java
import javax.crypto.spec.SecretKeySpec
import javax.crypto.Cipher
import javax.crypto.spec.IvParameterSpec
import java.math.BigInteger
import javax.crypto.SecretKeyFactory
import java.security.MessageDigest
import javax.xml.bind.DatatypeConverter._
object Crypto extends App {