Skip to content

Instantly share code, notes, and snippets.

View jonathas's full-sized avatar
💻
hacking

Jonathas Ribeiro jonathas

💻
hacking
View GitHub Profile
@jonathas
jonathas / list_builtin_exceptions.sql
Last active August 29, 2015 14:26
Oracle PL/SQL builtin exceptions
-- To list all the builtin exceptions:
SELECT *
FROM all_source
WHERE name = 'STANDARD'
AND upper(text) like '%EXCEPTION%';
/
-- To list all the builtin exception codes:
DECLARE
@jonathas
jonathas / upstream.sh
Created September 5, 2016 07:30
How to update a GitHub forked repository
# Add the remote, call it "upstream":
git remote add upstream https://github.com/whoever/whatever.git
# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
git fetch upstream
# Make sure that you're on your master branch:
@jonathas
jonathas / cut_video.sh
Created October 4, 2016 18:40
An ffmpeg example
ffmpeg -i movie.mp4 -ss 00:00:03 -t 00:00:08 -async 1 cut.mp4
@jonathas
jonathas / list_routes.js
Created October 26, 2016 15:55
Express - List configured routes
// List configured routes (for debugging purposes)
app._router.stack.forEach((r) => {
if (r.route && r.route.path) {
console.log(r.route.path);
}
});
@jonathas
jonathas / generate_installed.sh
Last active December 2, 2016 11:02
Generating a List of Installed Packages - Arch Linux
# Generating
pacman -Qe | awk '{print $1}' > package_list.txt
# Installing
for x in $(cat package_list.txt); do pacman -S $x; done
# This will also work, but Pacman will exit if you have a package
# installed that is not in the repositories.
pacman -S `cat package_list.txt`
@jonathas
jonathas / generate_pdf.sh
Created December 4, 2016 12:40
Generating PDF file from images using imagemagick
convert page.png page.pdf
convert page*.png mydoc.pdf
# To avoid generating huge PDF files, use something like
convert -compress jpeg -quality 85 *.png out.pdf
@jonathas
jonathas / swapfile_create.sh
Created May 3, 2017 15:43
Creates a swap file and activates it, then registers it in the fstab
#!/bin/bash
#
# Createss a swap file and activates it
# Jon Ribeiro <contact@jonathas.com> - 20170503
#
SWAPFILE="/var/local/swapfile"
SWAPFILE_SIZE=2048576 #2GB
dd if=/dev/zero of=$SWAPFILE bs=1024 count=$SWAPFILE_SIZE
@jonathas
jonathas / loadvbox.sh
Created July 20, 2017 11:32
Vbox modules
#!/bin/bash
sudo modprobe vboxdrv
sudo modprobe vboxnetflt
@jonathas
jonathas / jonathas_gpg.asc
Created October 16, 2017 20:02
My GPG public key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFnlCn0BEADhjvKRhCG4EebLmBl7Bg7VBz0lR8hGdF7g4sSaDbe4D0hnEWb6
6b8Cdy0WhzvHzvMsesfdQoqwcRz9oFrpVGFidpLJjJS7Bn52aqzS1kPPQAFhF8No
+wNayjrJsugr48IyiV7sl6sajlnDqwFRIodz0U0yarLwL7cweQvwVv1D1ahW/1Je
tlROsUtosu9m6YBwgnoekGJoiAmibwAl9UB6XZt5lb9vg3UzetAXA7fkl05WoZ2q
6AiFyinUWOKHLJW9Ah6JjFIWWWyuUOw3lcp+rk3E4sBmyYzZG/9nC6UyvntQUdbk
Pc1qwBt5eKo3QhSuZI05ai/m8pBHYUiv9c52swt+Hw2K/V4CMmWQBQTa0kTQ9mYY
GS5OOXcNy7WVHyeFBcFZkwUYVP74AjDGYNJscfkayCLRPV7MCgbHtYQ4U4pfBxPt
ffsqf5R9RyBw/J0vEeKwtFIUHV7VXJO4w36J1Vakq0H4SFiL52yLyUaDwLhn5v3d
@jonathas
jonathas / socket.io_examples.js
Created November 22, 2017 16:38
Examples of Socket.io commands
// sending to sender-client only
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender