Skip to content

Instantly share code, notes, and snippets.

View ssatz's full-sized avatar
🏠
Working from home

sathish ssatz

🏠
Working from home
View GitHub Profile
@jessedearing
jessedearing / gist:2351836
Created April 10, 2012 14:44 — forked from twoism-dev/gist:1183437
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active July 2, 2024 00:02
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@subfuzion
subfuzion / curl.md
Last active July 3, 2024 11:43
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@adamwathan
adamwathan / Marge.php
Last active September 19, 2023 13:11 — forked from davidhemphill/Marge.php
<?php
namespace App\Merge;
class Marge
{
protected $data = [];
public function setData($data)
{
@yukimochi
yukimochi / Caddyfile.caddy1
Last active June 30, 2024 03:03
For Mastodon Caddy Setting file. (Based on official Nginx configuration example) [Last Update: Mar 07, 2021]
https://yourdomain.example.com/ {
log / /var/log/caddy/mastodon.log "{combined}" {
rotate_age 90
}
root /home/mastodon/live/public
gzip
header / {
Strict-Transport-Security "max-age=31536000"
}
@ollieread
ollieread / builder.php
Last active February 15, 2022 15:48
Laravel query builder recursive CTE support
<?php
$recursive = $this->query()
->recursive('parents', function (Builder $query) {
$query
->select([
'*',
new Alias('slug', 'fullslug'),
new Alias(0, 'depth'),
new Alias('id', 'tree_id'),
new Alias('name', 'path'),
@nothingismagick
nothingismagick / caret.js
Last active April 16, 2024 10:09
Small script to detect caret pixel position in contenteditable div
/**
* Get the caret position in all cases
*
* @returns {object} left, top distance in pixels
*/
getCaretTopPoint () {
const sel = document.getSelection()
const r = sel.getRangeAt(0)
let rect
let r2
<?php
/**
* usage in a controlller:
* public function index($page=1) {
* $users = User::paginateUri(5, $page);
* return view('users', compact('users'));
* }
* it also support variable number of parameters,
* routes must be defined using {page} or {page?} placeholders
* $links is returned as reference and contain a standard bootstrap 3 navigation
@fourstacks
fourstacks / TestCase.php
Created September 9, 2020 08:25
Example TestCase using Laravel 8 model factories
<?php
namespace Tests;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Str;
abstract class TestCase extends BaseTestCase
{