Skip to content

Instantly share code, notes, and snippets.

View thelebster's full-sized avatar
Do nothing, it is ok.

Anton Lebedev thelebster

Do nothing, it is ok.
View GitHub Profile
thelebster / basic-http-auth-node.js
Created May 1, 2023 19:02 — forked from SunboX/basic-http-auth-node.js
Basic HTTP Authorization Header in Node.js
var key = <my key>,
secret = <my secret>,
https = require("https"),
https_options = {
"host": <host>,
"path": <path>,
"port": <port>,
"method": <method>,
"headers": {
"Authorization": "Basic " + new Buffer(key + ":" + secret, "utf8").toString("base64")
thelebster / mymodule.install.php
Created March 29, 2023 13:11 — forked from heitoralthmann/mymodule.install.php
Drupal 8 - Resizing field with existing data - Change text field max length
// This method of resizing field data TRUNCATES the information present in the field.
// This is heavily based on the solution available at
// with only a minor tweak to truncate field data before resizing the field, so we don't get an SQL error.
thelebster /
Created February 7, 2023 16:27 — forked from cesarmiquel/
Drupal 8 Cheatsheet

Drupal 8 Cheatsheet

Files, Images and Media

// Load file object
$file = File::load($fid);

// Get uri (public://foo/bar/baz.png)
$uri = $file-&gt;getFileUri(););
apt-get update
apt-get install -y ruby
mkdir codedeploy-agent_1.0-1.1597_ubuntu20
dpkg-deb -R codedeploy-agent_1.0-1.1597_all.deb codedeploy-agent_1.0-1.1597_ubuntu20
sed 's/2.0/2.7/' -i ./codedeploy-agent_1.0-1.1597_ubuntu20/DEBIAN/control
dpkg-deb -b codedeploy-agent_1.0-1.1597_ubuntu20
dpkg -i codedeploy-agent_1.0-1.1597_ubuntu20.deb
systemctl start codedeploy-agent
systemctl enable codedeploy-agent
thelebster / TrimMiddleware.php
Created January 14, 2023 19:29 — forked from mglaman/TrimMiddleware.php
TrimMiddleware for Drupal
namespace Drupal\mymodule\StackMiddleware;
use Symfony\Component\HttpFoundation\InputBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
thelebster /
Created December 16, 2022 07:25 — forked from bdargan/
Manually encrypt files with openssl.
rm -f content
rm *.enc
rm *.pem
rm keyfile
rm *.b64
rm *.dec
echo "generate: data-key for this content transfer"
thelebster / simple_rsa
Created December 16, 2022 07:20 — forked from chj1768/simple_rsa
RSA encryption / decryption example (nodejs)
openssl key pair generate
//client - using meteor.js
const nodersa = Npm.require('node-rsa');
import { HTTP } from 'meteor/http';
const syncPost = Meteor.wrapAsync(, HTTP );
encryptStringWithRsaPublicKey( data ) {
const absolutePath = Assets.absoluteFilePath( "public.key" ); //public key file path
const publicKey = fs.readFileSync( absolutePath, "utf8" );
thelebster / rsa.js
Created December 16, 2022 07:20 — forked from sohamkamani/rsa.js
An example of RSA Encryption implemented in Node.js
const crypto = require("crypto")
// The `generateKeyPairSync` method accepts two arguments:
// 1. The type ok keys we want, which in this case is "rsa"
// 2. An object with the properties of the key
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
// The standard secure default length for RSA keys is 2048 bits
modulusLength: 2048,
thelebster /
Created December 5, 2022 05:49 — forked from Iman/
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs