Skip to content

Instantly share code, notes, and snippets.

View daniel12fsp's full-sized avatar

Daniel Pereira daniel12fsp

View GitHub Profile
@daniel12fsp
daniel12fsp / show_git_all_commit.sh
Created April 25, 2019 12:52
This command shows all commit even if it is detached
git log $(git rev-list -g --all)
@daniel12fsp
daniel12fsp / pid_by_port.sh
Created April 22, 2019 19:43
PID by port
# To list any process listening to the port 8080:
lsof -i:8080
https://www.thegeekstuff.com/2010/07/bash-string-manipulation/
https://www.tldp.org/LDP/abs/html/string-manipulation.html
@daniel12fsp
daniel12fsp / keyboardEvent.js
Created February 12, 2019 12:38
Emulate keyboard event
// evt = ArrowLeft + Shift
const evt = new window.KeyboardEvent("keydown", {
key: "ArrowLeft",
shiftKey: true
});
document.dispatchEvent(evt);
@daniel12fsp
daniel12fsp / changeMac.sh
Created February 7, 2019 12:18
Change mac android
# To see mac
cat /sys/class/net/wlan0/address
# To change mac
ip link set wlan0 address MAC
@daniel12fsp
daniel12fsp / simple_ssdp.js
Created February 2, 2019 22:44
Simple SSDP Search
const dgram = require('dgram');
const search = new Buffer([
'M-SEARCH * HTTP/1.1',
'HOST: 239.255.255.250:1900',
'MAN: "ssdp:discover"',
'MX: 3',
'ST: ssdp:all'
].join('\r\n'));
@daniel12fsp
daniel12fsp / root_project.sh
Last active February 4, 2019 16:48
Get path root from git project in whenever child directory your are working
git rev-parse --show-toplevel
@daniel12fsp
daniel12fsp / start.sh
Created January 13, 2019 22:09
Download repo and open editor
#!/usr/bin/env bash
cd /tmp/
git clone $1;
#get name of repo
_repoFolder=$(echo $1 | cut -d "/" -f 5)
repoFolder=$(echo $_repoFolder | cut -d "." -f 1)
cd $repoFolder;
code $repoFolder;
@daniel12fsp
daniel12fsp / rename.sh
Created December 20, 2018 12:13
Rename all files ext1 to ext2
find -type f -name '*.jpg' | rename 's/\.jpeg$/.jpg/'
@daniel12fsp
daniel12fsp / keybindings.json
Created December 4, 2018 15:41
VS code bind shortcut =)
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "f12",
"command": "workbench.action.tasks.runTask",
"args" : "task-deploy"
}
]