Skip to content

Instantly share code, notes, and snippets.

View ai7ch's full-sized avatar
:octocat:
Git-tying up some code

ai7ch ai7ch

:octocat:
Git-tying up some code
View GitHub Profile
@phuntik
phuntik / calendar
Last active September 5, 2024 13:08
i3blocks notify-send calendar
#! /bin/bash
# dunstctl set-paused false
send_current() {
TODAY=$(date '+%-d')
month=$(ncal -bhMw)
BODY=$( tail -n7 <<< $month | sed "s/| /▕ /" | sed -z "s/ \($TODAY\) /<span bgcolor='white' color='black'> \1 <\/span>/1" | sed "s/\(.*\)\(.\{8\}\)$/\1<span color='IndianRed'>\2<\/span>/")
HEAD=$(echo "$month" | head -n1)
notify-send -a 'calendar' \
@WebInspectInc
WebInspectInc / README.md
Last active July 15, 2022 17:24
Sync .password-store.git repository
@bradtraversy
bradtraversy / docker-help.md
Last active March 11, 2025 16:05
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@bradtraversy
bradtraversy / webdev_online_resources.md
Last active March 4, 2025 07:44
Online Resources For Web Developers (No Downloading)
@bradtraversy
bradtraversy / ssh.md
Last active February 8, 2025 13:39
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh [email protected]

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

@CodeMyUI
CodeMyUI / burgers-sliders.markdown
Created November 21, 2017 22:52
Burgers & Sliders

Burgers & Sliders

A combination of a left sliding "mobile" navigation menu and a vertical slider / accordion.

A Pen by Erik Rahm on CodePen.

License.

@nnja
nnja / post-merge
Created October 2, 2017 01:19
Git Hook: Example post-merge hook that checks for updates to requirements.txt
#!/usr/bin/env python
import sys
import subprocess
diff_requirements = 'git diff ORIG_HEAD HEAD --exit-code -- requirements.txt'
exit_code = subprocess.call(diff_requirements.split())
if exit_code == 1:
print 'The requirements file has changed! Remember to install new dependencies.'
else:
@AtulKsol
AtulKsol / psql-error-fix.md
Last active November 13, 2024 12:43
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

@rchrd2
rchrd2 / test-php-basic-auth.php
Last active March 16, 2025 12:38 — forked from westonruter/test-php-basic-auth.php
PHP basic auth example
<?php
function require_auth() {
$AUTH_USER = 'admin';
$AUTH_PASS = 'admin';
header('Cache-Control: no-cache, must-revalidate, max-age=0');
$has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW']));
$is_not_authenticated = (
!$has_supplied_credentials ||
$_SERVER['PHP_AUTH_USER'] != $AUTH_USER ||
$_SERVER['PHP_AUTH_PW'] != $AUTH_PASS
@devthue
devthue / git-ignore-local.md
Created August 12, 2016 04:18
Git ignore files only locally

Sources: http://stackoverflow.com/questions/1753070/git-ignore-files-only-locally

The .git/info/exclude file has the same format as any .gitignore file. Another option is to set core.excludesFile to the name of a file containing global patterns.

Note, if you already have unstaged changes you must run the following after editing your ignore-patterns:

git update-index --assume-unchanged [<file>...]

Note on $GIT_DIR: This is a notation used all over the git manual simply to indicate the path to the git repository. If the environment variable is set, then it will override the location of whichever repo you're in, which probably isn't what you want.