Skip to content

Instantly share code, notes, and snippets.

View matheuseduardo's full-sized avatar
:octocat:
coding

Matheus Eduardo Silva Guimarães matheuseduardo

:octocat:
coding
View GitHub Profile
@matheuseduardo
matheuseduardo / keep.sh
Last active January 15, 2024 21:08
script to use transfer.sh website
keep() {
# check arguments
if [ $# -ne 1 ];
then
echo -e "Wrong arguments specified. Usage:\nkeep /tmp/test.md\ncat /tmp/test.md | keep test.md"
return 1
fi
# get temporary filename, output is written to this file so show progress can be showed
tmpfile="$( mktemp -t keepXXX )"
# EXTRACTED FROM http://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html
#rev. 1 - list all aliases (no check, no format, no validation)
# if user is not root, pass all commands via sudo #
if [ $UID -ne 0 ]; then
alias reboot='sudo reboot'
alias update='sudo apt-get upgrade'
fi
@matheuseduardo
matheuseduardo / base64.inc.asp
Created July 12, 2018 18:50
Base64 encoding / decoding functions in VbScript / Classic ASP
<%
Function Base64Encode(sText)
Dim oXML, oNode
Set oXML = CreateObject("Msxml2.DOMDocument.3.0")
Set oNode = oXML.CreateElement("base64")
oNode.dataType = "bin.base64"
oNode.nodeTypedValue = Stream_StringToBinary(sText)
Base64Encode = oNode.text
Set oNode = Nothing
Set oXML = Nothing
@matheuseduardo
matheuseduardo / get-page-by-slug.php
Last active March 23, 2022 07:58 — forked from micahblu/gist:5786794
get_page_by_slug - wordpress
<?php
/**
* Retrieve a page given its slug.
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $page_slug Page slug
* @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
* Default OBJECT.
* @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
@matheuseduardo
matheuseduardo / teambets.sp
Last active July 13, 2021 18:37
teambets.sp - v2.7.2 (Source + CSGO?)
/**
* teambets.sp
* Adds team betting. After dying, a player can bet on which team will win.
*/
#include <sourcemod>
#pragma semicolon 1
#define PLUGIN_VERSION "2.7.2"
public Plugin:myinfo =
{
name = "Team Bets",
@matheuseduardo
matheuseduardo / .gitalias
Last active May 3, 2021 12:42
alias para o git
alias.lg log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
alias.lg2 log --pretty='%h - %s (%an)'
alias.alias config --get-regexp ^alias\.
alias.unadd reset HEAD --
alias.unstage reset HEAD --
PASTAINICIO=$(pwd);
PATHHEADER="$PASTAINICIO/.header"
if (test -r $PATHHEADER)
then
cat $PATHHEADER;
fi
@matheuseduardo
matheuseduardo / DCIM-sizes.sh
Created January 22, 2019 12:47
shell script to list sizes of pics & vids
anos=`seq 2016 2018`; # 2016 a 2018
meses=`seq -w 1 12`; # todos os meses
for ano in $anos
do
for mes in $meses
do
data=$ano$mes;
tam=`du -c DCIM/**/IMG_$data*.jpg DCIM/**/VID_$data*.mp4 2> /dev/null | tail -1 | cut -f 1`
echo $data: $tam
##Test
Exclude
##Books
Chrome
Movies
Music
##PlayGames
Talkback
@matheuseduardo
matheuseduardo / example.md
Last active August 30, 2018 18:11
subir arquivo para WebDAV via shell