Skip to content

Instantly share code, notes, and snippets.

View viniciusdaniel's full-sized avatar

Vinicius Daniel Antunes Oliveira viniciusdaniel

View GitHub Profile
@vpnwall-services
vpnwall-services / SWAP-101.md
Created September 12, 2023 08:24
[SWAP 101] Swap 101 #linux #swap #101

SWAP 101

  • Allocate swap sudo fallocate -l 1G /swapfile

  • Alternate allocation sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576

  • Perms

@hugollm
hugollm / ajax-csrf-token.js
Created June 13, 2017 13:17
CSRF ajax setup for Django and JQuery
// https://docs.djangoproject.com/en/1.11/ref/csrf/#ajax
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}
}
});
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 15, 2024 01:06
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@viniciusdaniel
viniciusdaniel / bash-cheatsheet.sh
Created February 23, 2017 19:19 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@samgooi4189
samgooi4189 / bcm57765or57785fix
Last active April 19, 2024 04:20
Fixing Broadcom Corporation BCM57765/57785 SDXC/MMC Card Reader
Follow the WORKAROUND:
1. Add a comand to /etc/rc.local, add the following line above "exit 0":
setpci -s 00:1c.2 0x50.B=0x41
2. Add the same comand to /etc/apm/resume.d/21aspm (which does not exist yet):
setpci -s 00:1c.2 0x50.B=0x41
3. Add the following to /etc/modprobe.d/sdhci.conf:
options sdhci debug_quirks2=4
4. Re-generate initrd:
sudo update-initramfs -u -k all
5. Reboot or reload sdhci module:
@brock
brock / psql-with-gzip-cheatsheet.sh
Last active May 13, 2024 13:31
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@xiaoxiaoleo
xiaoxiaoleo / GoogleHackMasterList.txt
Last active April 28, 2024 23:08 — forked from cmartinbaughman/GoogleHackMasterList.txt
The definitive super list for "Google Hacking".
admin account info" filetype:log
!Host=*.* intext:enc_UserPassword=* ext:pcf
"# -FrontPage-" ext:pwd inurl:(service | authors | administrators | users) "# -FrontPage-" inurl:service.pwd
"AutoCreate=TRUE password=*"
"http://*:*@www&#8221; domainname
"index of/" "ws_ftp.ini" "parent directory"
"liveice configuration file" ext:cfg -site:sourceforge.net
"parent directory" +proftpdpasswd
Duclassified" -site:duware.com "DUware All Rights reserved"
duclassmate" -site:duware.com
@sjsyrek
sjsyrek / SheetThumbs.gs
Created February 14, 2015 00:26
Automatically insert thumbnails of Google Drive images directly into the cells of a Google Sheet using the =IMAGE(url) formula (not floating image overlays)
// Insert thumbnails of your Drive image files into a Google Sheet.
// Images are inserted directly into the cells of the sheet, not as those useless overlays that float around.
//
// This is set up to scan the first two columns of the active sheet. Column A will contain an =IMAGE(url) formula, which is calculated by finding the image thumbnail for the file referred to by column B.
// While this is simply the code I used for my own particular purpose, you can easily adapt it for your own needs. Please note that while an onEdit() version of this script would be cool, it will not work.
// Formulas cannot access most other Google Apps services, though you could probably use a data store if you felt ambitious enough.
// Note: the Drive Advanced API must be activated for this script to work.
//
// The script looks for files based on the pattern below:
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active May 9, 2024 03:03
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@somebox
somebox / presenters.md
Last active March 26, 2022 02:12
Thoughts About Rails Presenters

Thoughts about Rails Presenters

This is a collection of links, examples and rants about Presenters/Decorators in Rails.


The "Decorator" pattern slowly started gaining popularity in Rails several years ago. It is not part of core Rails, and there's many different interpretations about how it should work in practice.

Jay Fields wrote about it in 2007 (before he switched back to Java and then Clojure): http://blog.jayfields.com/2007/03/rails-presenter-pattern.html