Skip to content

Instantly share code, notes, and snippets.

@passuf
passuf / git-status
Last active June 5, 2017 17:54 — forked from mzabriskie/README.md
Check git status of multiple repos, source: https://gist.github.com/mzabriskie/6631607
#!/bin/bash
dir="$1"
# No directory has been provided, use current
if [ -z "$dir" ]
then
dir="`pwd`"
fi
@passuf
passuf / .xprofile
Last active April 2, 2023 09:13 — forked from zoqaeski/custom
Remap Logitech R400 Presenter Keys
# Add these commands to your ~/.xprofile file
/usr/local/bin/map_logitech_r400_keys_exec &
/usr/local/bin/file-inotify /tmp/logitech-r400.lock /usr/local/bin/map_logitech_r400_keys_exec &
@passuf
passuf / README.md
Created May 18, 2016 10:23 — forked from renchap/README.md
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
# Ubuntu 14.04 and 14.10
sudo apt-get install libav-tools
mkdir mp3 && for f in *.flac; do avconv -i "$f" -ab 320k -map_metadata 0 -id3v2_version 3 mp3/"${f%.*}".mp3; done
# To convert m4a files into mp3
mkdir mp3 && for f in *.m4a; do avconv -i "$f" -ab 320k -map_metadata 0 -id3v2_version 3 mp3/"${f%.*}".mp3; done
# Other Ubuntu versions with ffmpeg available
sudo apt-get install ffmpeg
mkdir mp3 && for f in *.flac; do ffmpeg -i "$f" -ab 320k -map_metadata 0 -id3v2_version 3 mp3/"${f%.*}".mp3; done
@passuf
passuf / .gitignore
Created September 27, 2015 13:57 — forked from kogakure/.gitignore
Git: .gitignore file for LaTeX projects
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl
@passuf
passuf / gist:7deceeeb8d802eb4a6f9
Last active August 29, 2015 14:17
Syncthing Setup

Install syncthing:

brew install syncthing

Create file /Users/passuf/Library/LaunchAgents/net.syncthing.osx.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >

SSL Cheat Sheet

Create self signed certificate:

openssl req -new -x509 -sha256 -newkey rsa:2048 -nodes -keyout server.key -days 365 -out server.crt

Create new key:

openssl genrsa -out server.key 2048
@passuf
passuf / mount-ram.sh
Last active August 29, 2015 14:12 — forked from koshigoe/mount-ram.sh
#!/bin/sh
# This program has two feature.
#
# 1. Create a disk image on RAM.
# 2. Mount that disk image.
#
# Usage:
# $0 <dir> <size>
#
@passuf
passuf / no-sticky.sh
Last active August 29, 2015 14:05
Disable Sticky Keys from Terminal (Universal Access System Settings, Ubuntu)
#!/bin/bash
# Disables the Universal Access Sticky Keys on Ubuntu, add this line e.g. to the Startup Applications
( sleep 60 && gsettings set org.gnome.desktop.a11y.keyboard stickykeys-enable false )&