Skip to content

Instantly share code, notes, and snippets.

View rodrigograca31's full-sized avatar
👨‍💻
Professional 🐛 solver

Rodrigo Graça rodrigograca31

👨‍💻
Professional 🐛 solver
View GitHub Profile
@rodrigograca31
rodrigograca31 / FormattedDate.php
Last active August 29, 2015 14:03
Formatted date
date_default_timezone_set("Europe/Lisbon");
echo date("H:i:s, d/m/Y", time());
//use here: http://writecodeonline.com/php/
<?
//From: http://php.net/manual/en/function.curl-exec.php
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "example.com");
@rodrigograca31
rodrigograca31 / caeser_decrypt.js
Last active August 29, 2015 14:06
Javascript function to decrypt text encrypted by Caeser cipher.
function caeser(number, caeser){
for(i=0; i< caeser.length; i++){
if(caeser.charCodeAt(i)>=65 && caeser.charCodeAt(i)<=90){
if(caeser.charCodeAt(i)+number>90){
document.write(String.fromCharCode((caeser.charCodeAt(i)-90)+64+number));
}else{
document.write(String.fromCharCode(caeser.charCodeAt(i)+number));
}
} else {
document.write(String.fromCharCode(caeser.charCodeAt(i)));
@rodrigograca31
rodrigograca31 / grep.sh
Last active August 29, 2015 14:15
Find string inside directory - Grep
grep -r ./ -e "open.mapquestapi.com/sdk"
grep -rn "open.mapquestapi.com/sdk" ./
@rodrigograca31
rodrigograca31 / tar.sh
Last active August 29, 2015 14:15
"Linux Zip"
#zip
tar -zcvf archive-name.tar.gz directory-name
#unzip
tar -zxvf archive-name.tar.gz
@rodrigograca31
rodrigograca31 / display.sh
Created April 24, 2015 14:34
Open graphic things on linux via ssh
oli@bert:~$ ssh tim
oli@tim:~$ export DISPLAY=:0
oli@tim:~$ firefox

Keybase proof

I hereby claim:

  • I am rodrigograca31 on github.
  • I am rodrigograca31 (https://keybase.io/rodrigograca31) on keybase.
  • I have a public key whose fingerprint is F005 31D8 7DFF A27E CD62 DD2C 41AC 4EB5 E083 6224

To claim this, I am signing this object:

@rodrigograca31
rodrigograca31 / node.sh
Created October 30, 2015 11:00
Install node on Raspberry Pi 2 B
uname -a
wget https://nodejs.org/dist/v5.0.0/node-v5.0.0-linux-armv7l.tar.gz
tar -xvzf node-v5.0.0-linux-armv7l.tar.gz
ls -la
cd node-v5.0.0-linux-armv7l/bin/
pwd
echo 'export PATH=/home/pi/node-v5.0.0-linux-armv7l/bin:$PATH' >> ~/.bashrc
@rodrigograca31
rodrigograca31 / sleeptimer.sh
Created December 21, 2015 16:37
Suspend computer after X minutes
#!/bin/bash
#
# sleeptimer.sh
#
# Author: Timothy A.V. Teatro <[email protected]>
# Date : Jan 11, 2011
#
# Description: A rather unsophisticated little script that I wrote for
# myself. Since I usually fall asleep listening to gnaural or watching
# a movie on my computer beside my bed, I wanted something to suspend
@rodrigograca31
rodrigograca31 / user.sql
Created December 28, 2015 18:35
Create mysql user and give permissions
CREATE USER 'user'@'%';
SET PASSWORD FOR 'user'@'%' = PASSWORD('password');
GRANT ALL PRIVILEGES ON database.* TO 'user'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;