Skip to content

Instantly share code, notes, and snippets.

View jtraulle's full-sized avatar

Jean Traullé jtraulle

View GitHub Profile
@blobaugh
blobaugh / gitlab-job-artifact-cleanup.sh
Created October 27, 2022 14:14
Bash script to clean up job artifacts created in Gitlab. Adapted from https://forum.gitlab.com/t/remove-all-artifact-no-expire-options/9274
#!/bin/bash
# Copyright 2021 "Holloway" Chew, Kean Ho <kean.ho.chew@zoralab.com>
# Copyright 2020 Benny Powers (https://forum.gitlab.com/u/bennyp/summary)
# Copyright 2017 Adam Boseley (https://forum.gitlab.com/u/adam.boseley/summary)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@fessmage
fessmage / add-to-ssh-known-hosts.yml
Created April 22, 2021 12:47
Add all hosts from ansible inventory to ssh known_hosts file of current user
- name: Gather facts from 'all' hosts in inventory
hosts: all
vars:
ansible_host_key_checking: false
ansible_ssh_extra_args: '-o UserKnownHostsFile=/dev/null'
tasks:
- setup:
gather_subset: network
- name: Add public keys to known_hosts file
@VeryStrongFingers
VeryStrongFingers / php-phpdbg-proxy.sh
Last active June 29, 2020 06:53
PHPStorm - PHP-PHPDBG Interpreter proxy
#!/bin/bash
#### Dirty/Fake PHP Interpreter to trick PHPStorm into using PHPDBG for running tests with/without code coverage
## For Mac/Linux only, Window's ubuntu subsystem theoretically would work too
##
## JETBRAINS IMPLEMENTED THE FEATURE REQUEST. No need to use this script anymore.
##
##
## Related JetBrain's issues/feature requests
## https://youtrack.jetbrains.com/issue/WI-21414
@ansemjo
ansemjo / ssh-auth-sock.service
Last active February 19, 2024 03:00 — forked from xenithorb/ssh-auth-sock.service
systemd user unit to set SSH_AUTH_SOCK variable for X11/Wayland/GNOME and make it work with GnuPG agent
# Place this file in ~/.config/systemd/user/ssh-auth-sock.service
# $ systemctl --user daemon-reload
# $ systemctl --user enable --now ssh-auth-sock.service
# Add 'echo UPDATESTARTUPTTY | gpg-connect-agent >/dev/null' in your ~/.bashrc.
# Logout or reboot.
[Unit]
Description=Set SSH_AUTH_SOCK to GnuPG agent
[Service]
@mrkpatchaa
mrkpatchaa / git-export-changes-between-two-commits.md
Last active September 29, 2020 03:51
[Git command to export only changed files between two commits] #git

Use case : Imagine we have just created a project with composer create-project awesone-project (currently V0.2). 2 weeks later, there is a new release (V0.3). How to update your project ? Since composer update only updates the project dependencies, it is not what we are looking for. Composer doesn't know about awesome-project since it's not in our composer.json.

After trying many git solutions, I've come to this :

git archive --output=changes.zip HEAD $(git diff --name-only SHA1 SHA2 --diff-filter=ACMRTUXB)

This command will check for changes between the two commits and ignore deleted files.

@LauLaman
LauLaman / gpg.md
Last active March 7, 2023 14:42
Use GPG to sign commits using git & PHPStorm

1 - install GPG tools : https://gpgtools.org/

2 - Create new key for your github email

3 - Add key to git on your local machine: git config --global user.signingkey YOURKEY

4 - configure git to sign all commits: git config --global commit.gpgsign true

5 - add to the bottom of ~/.gnupg/gpg.conf: (create the file if it not exists)

@robinvdvleuten
robinvdvleuten / lambda-helloWorld.php
Last active March 2, 2022 00:41
Invoke sample Lambda function through PHP
<?php
require_once __DIR__.'/vendor/autoload.php';
use Aws\Lambda\LambdaClient;
$client = LambdaClient::factory([
'version' => 'latest',
// The region where you have created your Lambda
'region' => 'eu-west-1',
@koenpunt
koenpunt / chosen-bootstrap.css
Last active March 11, 2023 01:01
Bootstrap 3.0 theme for Chosen
select.form-control + .chosen-container.chosen-container-single .chosen-single {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555;
vertical-align: middle;
background-color: #fff;
@deizel
deizel / tail.php
Created October 6, 2012 22:08
PHP log tail example
<?php
if (isset($_GET['ajax'])) {
session_start();
$handle = fopen('/private/var/log/system.log', 'r');
if (isset($_SESSION['offset'])) {
$data = stream_get_contents($handle, -1, $_SESSION['offset']);
echo nl2br($data);
} else {
fseek($handle, 0, SEEK_END);
$_SESSION['offset'] = ftell($handle);
@weaverryan
weaverryan / forms.html.twig
Created April 13, 2012 11:26
Some basic Twitter Bootstrap Symfony2 form customizations
{# for twitter bootstrap specifically #}
{% block field_row %}
{% spaceless %}
<div class="control-group {% if errors|length > 0 %}error{% endif %}">
{{ form_label(form, label|default(null)) }}
<div class="controls">
{{ form_widget(form) }}
{{ form_errors(form)}}
</div>
</div>