Skip to content

Instantly share code, notes, and snippets.

View aslafy-z's full-sized avatar

Zadkiel AHARONIAN aslafy-z

View GitHub Profile
@aslafy-z
aslafy-z / system-sleep-xhci.sh
Created May 31, 2023 06:11 — forked from ioggstream/system-sleep-xhci.sh
Disable broken xhci device before suspend and avoid freeze.
#!/bin/sh
#
# This script should prevent the following suspend errors
# which freezes the Dell Inspiron laptop.
#
# Put it in /usr/lib/systemd/system-sleep/xhci.sh
#
# The PCI 00:14.0 device is the usb xhci controller.
#
# kernel: [67445.560610] pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -16
@aslafy-z
aslafy-z / create_user_for_namespace.sh
Last active April 25, 2022 08:31 — forked from steimntz/create_user_for_namespace.sh
Script to create user with permission for a specific namespace.
#!/bin/bash
#
# Script based on https://jeremievallee.com/2018/05/28/kubernetes-rbac-namespace-user.html
#
# In honor of the remarkable Windson
#/bin/bash
namespace=$1
if [ -z "$namespace" ]; then
echo "usage: $0 <NAMESPACE>"
@aslafy-z
aslafy-z / Jenkinsfile
Last active December 13, 2023 19:52 — forked from rufoa/Jenkinsfile
Jenkins [skip ci] implementation for multi-branch declarative pipeline
pipeline {
...
stages {
stage('Run CI?') {
steps {
script {
if (sh(script: "git log -1 --pretty=%B | grep -F -ie '[skip ci]' -e '[ci skip]'", returnStatus: true) == 0) {
currentBuild.result = 'NOT_BUILT'
error 'Aborting because commit message contains [skip ci]'
@aslafy-z
aslafy-z / background.js
Created May 29, 2020 13:18 — forked from muralikg/background.js
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {
@aslafy-z
aslafy-z / docker-compose-systemd-unit.md
Last active February 23, 2024 15:59 — forked from mosquito/README.md
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service

[Unit]
Description=%i service with docker compose
# Requires=docker.service
# After=docker.service
@aslafy-z
aslafy-z / centos.repo
Last active June 24, 2019 07:58 — forked from slapo/wandisco-git.repo
CentOS 6 base repository
[centos]
name=centos
baseurl=http://mirror.centos.org/centos/6/os/x86_64/
enabled=0
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6
@aslafy-z
aslafy-z / serveo-tunnel@.service
Last active February 16, 2024 15:03 — forked from guettli/ssh-tunnel@.service
Reliable persistent SSH-Tunnel via systemd (not autossh)
# Reliable persistent SSH-Tunnel via systemd (not autossh)
# https://gist.github.com/aslafy-z/24e2ddb02fa269444620eab1bcfe2932#file-serveo-tunnel-service
#
# Usage: systemctl start serveo-tunnel@[tunnel-string] (see https://serveo.net for details)
# systemctl start serveo-tunnel@mytunnel:80:localhost:8080
# systemctl enable serveo-tunnel@mytunnel:80:localhost:8080 (to make it persist reboot)
[Unit]
Description=Serveo tunnel for %i
After=network.target
@aslafy-z
aslafy-z / index.html
Created July 22, 2018 14:48 — forked from chrisvfritz/index.html
Simplest possible HTML template
<!doctype html>
<html>
<head>
<title>This is the title of the webpage!</title>
</head>
<body>
<p>This is an example paragraph. Anything in the <strong>body</strong> tag will appear on the page, just like this <strong>p</strong> tag and its contents.</p>
</body>
</html>
@aslafy-z
aslafy-z / functions.php
Last active June 19, 2018 10:57 — forked from cjmosure/functions.php
Disable single Wordpress plugin update notifications
<?php
// Disable update notification for individual plugin (current)
function filter_plugin_updates($value) {
if ($value) {
unset($value->response[plugin_basename(__FILE__)]);
}
return $value;
}
add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );
?>
@aslafy-z
aslafy-z / db-far.php
Created June 1, 2018 13:50 — forked from KLicheR/db-far.php
PHP script that perform a find and replace in a database dump (tested with MySQL) with adjustments of the PHP serialize founded.
#!/usr/bin/php
<?php
/**
* PHP script that perform a find and replace in a database dump (tested with
* MySQL) with adjustments of the PHP serialize founded.
*
* Don't forget to escape your "special characters":
* "a$b" -> "a\$b"
* "a"b" -> "a\"b"
* "a`b" -> "a\`b"