Skip to content

Instantly share code, notes, and snippets.

<?php
$in = <<<'JSON'
[
{
"Date": "2014-12-01",
"StartTime": "10:00",
"EndTime": "16:00"
},
{
@beingsane
beingsane / pdfunite.sh
Created April 17, 2020 18:25 — forked from isaqueprofeta/pdfunite.sh
Pdftk to unite all files in a folder
#!/bin/bash
pdftk *.pdf cat output combined.pdf
@beingsane
beingsane / start.sh
Created April 17, 2020 18:25 — forked from isaqueprofeta/start.sh
My start script for customized laradock showing IP's
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Uso : $0 Stack a ser usado (zabbix/webdev)"
exit
fi
case "$1" in
@beingsane
beingsane / gist:d916d9f5efd5d9759481dd752b095f77
Created April 17, 2020 18:25 — forked from isaqueprofeta/zabbix_queries.sh
Curl post to zabbix api (api_jsonrpc.php)
curl -i -X POST -H 'Content-type:application/json' -d '{"jsonrpc":"2.0","method":"user.login","params":{ "user":"myUserName","password":"myPassword"},"auth":null,"id":0}' https://zabbix.server/api_jsonrpc.php
curl -i -X POST -H 'Content-type:application/json' -d '{"jsonrpc":"2.0","method":"host.get","params":{"output": ["hostid", "name"]},"auth":"<AUTH_KEY>","id":0}' https://zabbix.server/api_jsonrpc.php
use GuzzleHttp\Client;
class yourController extends Controller {
public function saveApiData()
{
$client = new Client();
$res = $client->request('POST', 'https://url_to_the_api', [
'form_params' => [
#!/bin/sh
for f in *.mp4;
do
HandBrakeCLI -i "$f" -o "${f}.m4v" --preset="480p";
done
@beingsane
beingsane / argv.json
Created August 21, 2020 17:05 — forked from guilhermerodz/argv.json
VSCode setup
// This configuration file allows you to pass permanent command line arguments to VS Code.
// Only a subset of arguments is currently supported to reduce the likelyhood of breaking
// the installation.
//
// PLEASE DO NOT CHANGE WITHOUT UNDERSTANDING THE IMPACT
//
// NOTE: Changing this file requires a restart of VS Code.
{
// Use software rendering instead of hardware accelerated rendering.
// This can help in cases where you see rendering issues in VS Code.

How to dump and import PostgreSQL database

Below some step by step with bash functions example on how to dump your database and restore it to your db server.

✅ Dump the source database to a file.

function pgDumpDB() {
    echo 'Type db user: ' && read DBUSER;
    echo 'Type db name: ' && read DBNAME;
 pg_dump -U $DBNAME -O $DBNAME $DBNAME.sql 
@beingsane
beingsane / cascade_delete_with_procedures_postgres.sql
Created October 14, 2020 18:42 — forked from maykbrito/cascade_delete_with_procedures_postgres.sql
Delete Cascade with Trigger and Procedures PostgreSQL.
CREATE TABLE "users" (
"id" SERIAL PRIMARY KEY,
"name" TEXT NOT NULL
);
CREATE TABLE "files" (
"id" SERIAL PRIMARY KEY,
"name" text NOT NULL
);
@beingsane
beingsane / GoogleDorking.md
Created July 19, 2021 14:47 — forked from sundowndev/GoogleDorking.md
Google dork cheatsheet

Google dork cheatsheet

Search filters

Filter Description Example
allintext Searches for occurrences of all the keywords given. allintext:"keyword"
intext Searches for the occurrences of keywords all at once or one at a time. intext:"keyword"
inurl Searches for a URL matching one of the keywords. inurl:"keyword"
allinurl Searches for a URL matching all the keywords in the query. allinurl:"keyword"
intitle Searches for occurrences of keywords in title all or one. intitle:"keyword"