Skip to content

Instantly share code, notes, and snippets.

@xPaw
xPaw / localhost_cert.sh
Last active January 1, 2022 20:23
Localhost certificate
#!/bin/bash
openssl ecparam -name prime256v1 -genkey -out localhost.key
openssl req -new -x509 -days 7300 -out localhost.crt -key localhost.key \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost, DNS:*.localhost, IP:127.0.0.1, IP:::1\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
openssl dhparam -out dhparam.pem 4096
@amit-chahar
amit-chahar / download-script.sh
Last active February 20, 2023 12:57
Scirpt to download files from Google drive using curl (Detailed explanation can be read here: https://stackoverflow.com/a/49444877/4043524)
#!/bin/bash
fileid="FILEIDENTIFIER"
filename="FILENAME"
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null
curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${fileid}" -o ${filename}
@Ndrou
Ndrou / clean-db.sql
Created March 8, 2017 10:03
Clean prestashop 1.6 database
DELETE FROM ps_accessory WHERE id_product_1 NOT IN (select p.id_product from ps_product p);
DELETE FROM ps_accessory WHERE id_product_2 NOT IN (select p.id_product from ps_product p);
DELETE FROM ps_address WHERE id_customer NOT IN (select c.id_customer from ps_customer c);
DELETE FROM ps_product_comment WHERE id_product NOT IN (select p.id_product from ps_product p);
DELETE FROM ps_product_comment_grade WHERE id_product_comment NOT IN (select pc.id_product_comment from ps_product_comment pc);
DELETE FROM ps_product_comment_usefulness WHERE id_product_comment NOT IN (select pc.id_product_comment from ps_product_comment pc);
DELETE FROM ps_product_lang WHERE id_product NOT IN (select p.id_product from ps_product p);
@rchrd2
rchrd2 / test-php-basic-auth.php
Last active February 1, 2024 21:18 — 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
@sj26
sj26 / LICENSE.md
Last active March 8, 2024 18:31
Bash retry function

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@kslimani
kslimani / ixgbe_debian.md
Last active January 29, 2024 19:10
Debian ixgbe module compilation
@matgou
matgou / hotbackup.sh
Last active December 4, 2019 07:38
Hot-backup of mysql with btrfs
#!/bin/bash
#@****************************************************************************
#@ Author : Mathieu GOULIN (mathieu.goulin@gadz.org)
#@ Organization : Gadz.org (www.gadz.org)
#@ Licence : GNU/GPL
#@
#@ Description :
#@
#@ Prerequisites :
#@ Arguments :
@thisismitch
thisismitch / haproxy.cfg
Last active November 11, 2023 04:08
Let's Encrypt Auto-Renewal script for HAProxy
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 2048
@opennomad
opennomad / snippy.sh
Last active November 5, 2019 15:59 — forked from coderofsalvation/snippy.sh
Snippy text expander
#!/usr/bin/env bash
# video demo at: http://www.youtube.com/watch?v=90xoathBYfk
# augmented by "opennomad": https://gist.github.com/opennomad/15c4d624dce99066a82d
# originally written by "mhwombat": https://bbs.archlinux.org/viewtopic.php?id=71938&p=2
# Based on "snippy" by "sessy"
# (https://bbs.archlinux.org/viewtopic.php?id=71938)
#
# You will also need "dmenu", "zenity", "xsel" and "xdotool". Get them from your linux
# distro in the usual way.