Skip to content

Instantly share code, notes, and snippets.

@daalvand
daalvand / backup.sh
Last active July 31, 2023 09:18
Backup Docker Images
#!/bin/bash
images_dir="$(dirname "$(readlink -f "$0")")/images"
mkdir -p $images_dir
#This awk command removes duplicates based on the last field ({{.ID}}) of the input lines by utilizing an associative array seen. It prints only the first occurrence of each unique ID
images=$(docker images --format "{{.Repository}}:{{.Tag}}-{{.ID}}" --filter "dangling=false" | awk -F'-' '!seen[$NF]++')
for image in $images; do
@n1snt
n1snt / Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md
Last active December 15, 2025 20:45
Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@MicahParks
MicahParks / go get private GitLab with group and subgroup (Golang modules).md
Last active October 28, 2025 12:42
go get private GitLab with group and subgroup (Golang modules)

Problem

The go command line tool needs to be able to fetch dependencies from your private GitLab, but authenticaiton is required.

This assumes your private GitLab is hosted at privategitlab.company.com.

Environment variables

The following environment variables are recommended:

export GO111MODULE=on
export GOPRIVATE=privategitlab.company.com
#!/bin/bash
# A simple convertor for change the text from selection and replace all persian charachter with
# English charachter in clipboard.
# Just assign it to a key binding, with anything you like (i3 for example).
# I wrote this for http://linuxvaman.ir/
# Publishe under WTFPL
# fzerorubigd <[email protected]> 2 Dec 2015
change_string() {
@baiwfg2
baiwfg2 / it-ebooks.md
Last active December 15, 2025 10:19
Download ebooks as you want
@gaearon
gaearon / modern_js.md
Last active December 2, 2025 08:14
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@dutymess
dutymess / Yasna.xml
Created April 25, 2018 13:45
PHPStrom Code Style Settings (not violating PSR1&2)
<code_scheme name="Yasna">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
@crgimenes
crgimenes / stringToReaderCloser.go
Last active March 11, 2025 06:14
string to io.ReadCloser
package main
import (
"bytes"
"fmt"
"io"
"os"
"strings"
)
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions - [email protected]</title>
</head>
<body>
<outline text="PHP" title="PHP">
<outline htmlUrl="http://frederickvanbrabant.com" title="frederickvanbrabant.com" xmlUrl="http://frederickvanbrabant.com/feed.xml" type="rss" text="frederickvanbrabant.com"/>
<outline htmlUrl="http://mattallan.org" title="mattallan.org" xmlUrl="http://mattallan.org/feed.xml" type="rss" text="mattallan.org"/>
<outline title="asked.io" xmlUrl="https://asked.io/rss" type="rss" text="asked.io"/>
@wbotelhos
wbotelhos / clear-sidekiq-jobs.sh
Last active August 10, 2025 09:09
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear