Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
o/

João Silva Xplouder

:octocat:
o/
View GitHub Profile
View Create Heroku App (Laravel)
1) Create a new laravel instalation
-> composer create-project laravel/laravel
Or just use an existing project
2) Create a file named Procfile (without extension) in root laravel folder
2.1) Add this line:
-> web: vendor/bin/heroku-php-apache2 public
3) Install Heroku Toolbelt
-> https://devcenter.heroku.com/articles/getting-started-with-php#set-up
@Xplouder
Xplouder / elasticsearch_logs_handbook.md
Last active Feb 24, 2021
Elasticsearch Logs Handbook
View elasticsearch_logs_handbook.md

Fetch documents with timetamp lower than the defined date (curl format)

curl --request GET \
  --url http://localhost:9200/_search \
  --header 'Content-Type: application/json' \
  --header 'cache-control: no-cache' \
  --data '{\n  "query": {\n    "bool": {\n      "filter": {\n        "range": {\n          "@timestamp": {\n            "lt": "2019-01-01"\n          }\n        }\n      }\n    }\n  }\n}'
@Xplouder
Xplouder / description.md
Last active May 16, 2019
PHP - Rewrite dependencies classes
View description.md

Class Alias

<?php

namespace Shop\Models;

use Shop\Models\Address as AddressClass;

/** @var Address parent */
class_alias(defined('AddressClass') ? AddressClass : Address::class, 'ThingPink\Shop\Models\AddressClass');
View Scripts.md

rename entire folder content to ordered filenames

ls | cat -n | while read n f; do mv "$f" "optional_prefix$n.jpg"; done

remove files with odd numbers in the name ending

ls | grep -P '[02468]\.\w*$' | xargs -d "\n" rm

revert the order of ordered filenames

for i in {1..50}; do mv "$i.jpg" "renamed/shirt_$(( 50 - $i + 1 )).jpg"; done

remove some text recursively from you current directory

View keybase.md

Keybase proof

I hereby claim:

  • I am xplouder on github.
  • I am xplouder (https://keybase.io/xplouder) on keybase.
  • I have a public key ASBzqnWkbkmQNiYH7tUwPs4CA-BN3QmyVzXns731BQjLSQo

To claim this, I am signing this object:

@Xplouder
Xplouder / service.md
Created Dec 21, 2018
FIX: Linux suspend interrupt with ACPI wakeup
View service.md

For Ubuntu 15+, you must use systemd instead of rc.local. You may google "Creating a systemd service" and follow the instructions, but note that redirecting output to /proc/acpi/wakeup is tricky. To get it to work correctly, you must do something like:

/bin/sh -c '/bin/echo XHC > /proc/acpi/wakeup'

Example output for the service file (e.g., /etc/systemd/system/suspendfix.service):

[Unit]
Description=fix to prevent system from waking immediately after suspend
@Xplouder
Xplouder / Linux Mint terminal on steroids!
Last active Jul 2, 2016
Linux Mint terminal on steroids!
View Linux Mint terminal on steroids!
1) > sudo apt-get install zsh
2) > chsh -s $(which zsh)
2) > sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
3) configurate themes and plugins
4) > wget https://github.com/Lokaltog/powerline/raw/develop/font/PowerlineSymbols.otf https://github.com/Lokaltog/powerline/raw/develop/font/10-powerline-symbols.conf
> mkdir -p ~/.fonts/ && mv PowerlineSymbols.otf ~/.fonts/
> fc-cache -vf ~/.fonts
> mkdir -p ~/.config/fontconfig/conf.d/ && mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/
5) logout & login / reboot
6) Optionally set DEFAULT_USER in ~/.zshrc to your regular username to hide the “user@hostname” info when you’re logged in as yourself on your local machine.
View gist:b33ca9bc7de5653330b0
CREATE OR REPLACE PACKAGE pck_extract IS
PROCEDURE main (p_initialize BOOLEAN);
PROCEDURE read_file(p_dir VARCHAR2, p_file_name VARCHAR2);
END pck_extract;
/
create or replace PACKAGE BODY pck_extract IS