Skip to content

Instantly share code, notes, and snippets.

View FootballFan141's full-sized avatar
👋
Hey!

Travis FootballFan141

👋
Hey!
View GitHub Profile

Installed plugins for Sublime Text 3

2017.05.20 update.

  • A File Icon
  • AdvancedNewFile
  • All Autocomplete
  • ApacheConf.tmLanguage
  • AutoFileName
  • Babel
// Originally used on https://nookipedia.com/wiki/Fish/Animal_Crossing:_Wild_World to extract fish data
returnedObj = '[\n';
function scrapeFish() {
for (var i = 0; i < 56; i++) {
fishName = document.body.children[7].children[0].children[0].children[1].children[0].children[1].children[1].children[4].children[3].children[0].children[2].children[0].children[1].children[i].children[1].children[0].innerHTML;
returnedObj += `\t{'task_name': '${fishName}', 'task_complete': false},\n`;
}
returnedObj += '\n]';
return returnedObj;
}
@dbilovd
dbilovd / ide-plugins.md
Last active February 1, 2019 20:52
IDE Plugins
@AtulKsol
AtulKsol / psql-error-fix.md
Last active April 10, 2024 07:41
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

@mseemann
mseemann / reactiveform.component.ts
Last active October 13, 2019 06:40
Reactive Forms Example(ts)
import {
Component,
OnInit
} from '@angular/core';
import { flyInOutTrigger } from './../animations/flyInOutTrigger-animation';
import { hostConfig } from './../animations/flyInOutTrigger-animation';
import {
FormGroup,
FormControl,
Validators,
@wiesys
wiesys / swipe.js
Last active March 9, 2021 03:12 — forked from SleepWalker/swipe.js
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.changedTouches[0].pageX;
touchstartY = event.changedTouches[0].pageY;
@henriquemenezes
henriquemenezes / android-generate-keystores.md
Last active April 6, 2024 13:37
Android: Generate Release/Debug Keystores

Android: Generate Release/Debug Keystores

Generate Keystores

Debug Keystore

$ keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "C=US, O=Android, CN=Android Debug"
@corenominal
corenominal / API Key Generator.markdown
Created December 12, 2015 22:40
API Key Generator
@SleepWalker
SleepWalker / swipe.js
Created September 30, 2015 04:59
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.screenX;
touchstartY = event.screenY;
@joecampo
joecampo / fail2ban.md
Last active March 26, 2024 15:36
fail2ban – stop HTTP(S) route abuse/brute forcing

If you're not familiar: What is fail2ban? fail2ban is an awesome linux service/monitor that scans log files (e.g. auth.log for SSH) for potentially malicious behavior. Once fail2ban is tripped it will ban users for a specified duration by adding rules to Iptables. If you're unfamiliar with fail2ban Chris Fidao has a wonderful (& free!) series about security including setting up fail2ban here.

Recently Laravel released a new feature in 5.1 to throttle authentication attempts by simply adding a trait to your authentication controller. The Laravel throttle trait uses the inputted username, and IP address to throttle attempts. I love seeing this added to a framework out of the box, but what about some of our other apps not built on Laravel? Like a WordPress login? Or even an open API etc.? Ultimately,