Skip to content

Instantly share code, notes, and snippets.

@larshaendler
larshaendler / multiple-files-remove-prefix.md
Created Jan 22, 2019
Remove prefix from multiple files in Linux console
View multiple-files-remove-prefix.md

Bash

for file in prefix*; do mv "$file" "${file#prefix}"; done;

The for loop iterates over all files with the prefix. The do removes from all those files iterated over the prefix.

Here is an example to remove "bla_" form the following files:

bla_1.txt
bla_2.txt
@nikhita
nikhita / README.md
Created Jun 19, 2017 — forked from robertpainsi/README.md
How to reopen a pull-request after a force-push?
View README.md

You need the rights to reopen pull requests on the repository.

  1. Write down the current commit hash of your PR-branch git log --oneline -1 <PR-BRANCH>
  2. Write down the latest commit hash on github before the PR has been closed.
  3. git push -f origin <GITHUB-HASH-FROM-STEP-2>:<PR-BRANCH>
  4. Reopen the PR.
  5. git push -f origin <HASH-FROM-STEP-1>:<PR-BRANCH>

Example

You've a PR branch my-feature currently at 1234567. Looking at the the PRs page, we see that the PR was closed when my-feature pointed at 0abcdef.

@exts
exts / fresh-php7-nginx-server.txt
Last active Feb 27, 2020
Fresh PHP 7.3 LEMP setup info/Ubuntu 16
View fresh-php7-nginx-server.txt
# install nginx
sudo apt install nginx
# add php7.X repository
sudo add-apt-repository ppa:ondrej/php
sudo apt update
# search libraries
sudo apt search php7-*
@vinzenz
vinzenz / dial-mysql-via-ssh.go
Created Nov 7, 2016
Using MySQL / MariaDB via SSH in Golang
View dial-mysql-via-ssh.go
package main
import (
"database/sql"
"fmt"
"net"
"os"
"github.com/go-sql-driver/mysql"
"golang.org/x/crypto/ssh"
@josephspurrier
josephspurrier / etc-init.d-hello-world
Last active Mar 6, 2021
/etc/init.d Script for Go Application
View etc-init.d-hello-world
#!/bin/bash
#
# chkconfig: 35 95 05
# description: Hello world application.
# Run at startup: sudo chkconfig hello-world on
# Load functions from library
. /etc/init.d/functions
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active Mar 4, 2021
Compress mp4 using FFMPEG
View ffmpeg-compress-mp4
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4