Skip to content

Instantly share code, notes, and snippets.

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

Anton Lebedev thelebster

:octocat:
Do nothing, it is ok.
View GitHub Profile
@thelebster
thelebster / uniqid.php
Created May 6, 2017 10:23 — forked from james2doyle/uniqid.php
PHP uniqid function written in pure PHP
<?php
/*
* Use this if you need to recreate `uniqid` in another language
* From: http://php.net/manual/en/function.uniqid.php#95001
*/
// time in microseconds as float
$m = microtime(true);
@thelebster
thelebster / ubuntu_mount_efs.md
Created July 6, 2024 14:22 — forked from ryanmaclean/ubuntu_mount_efs.md
Mount EFS on Ubuntu Linux

EFS Mounting on Ubuntu

Get EFS ID

aws configure set preview.efs true
aws efs describe-file-systems --profile TEST --region us-east-2
{
@thelebster
thelebster / ngrok-install.md
Created July 6, 2017 06:34
Expose localhost to the internet with Ngrok

Expose Localhost to the Internet With Ngrok

If you want a way to access your localhost easily on the public internet, lets say, to showcase the current work to a client, etc. This is where ngrok comes in. It allows us to establish a tunnel that forwards a port on our machine and make it available on the internet.

Ngrok is a Go program, distributed as a single executable file for all major desktop platforms. There are no additional frameworks to install or other dependencies.

This tutorial assumes you are using MAMP and have previously set up DNSMASQ.

@thelebster
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
thelebster / drupal-8-cheatsheet.md
Created February 7, 2023 16:27 — forked from cesarmiquel/drupal-8-cheatsheet.md
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(););
@thelebster
thelebster / drush-site-install
Created October 22, 2016 05:45 — forked from szeidler/drush-site-install
Drush site install command
drush site-install standard --db-url='mysql://[db_user]:[db_pass]@localhost/[db_name]' --site-name=Example --sites-subdir=example.com --account-name=admin --account-pass=password --account-mail=mail@example.com
@thelebster
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
<?php
//
// ATTENTION!
// This method of resizing field data TRUNCATES the information present in the field.
// This is heavily based on the solution available at https://github.com/evolvingweb/custom_field_resize
// with only a minor tweak to truncate field data before resizing the field, so we don't get an SQL error.
//
apt-get update
apt-get install -y ruby
wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/releases/codedeploy-agent_1.0-1.1597_all.deb
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
thelebster / TrimMiddleware.php
Created January 14, 2023 19:29 — forked from mglaman/TrimMiddleware.php
TrimMiddleware for Drupal
<?php
declare(strict_types=1);
namespace Drupal\mymodule\StackMiddleware;
use Symfony\Component\HttpFoundation\InputBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;