Skip to content

Instantly share code, notes, and snippets.

@StudioEtrange
StudioEtrange / getopt.c
Last active August 29, 2015 14:22 — forked from ashelly/getopt.c
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@StudioEtrange
StudioEtrange / Apple MacOS Finder show Hidden Files switch.md
Last active January 31, 2018 14:40
Apple MacOS -- Finder show Hidden Files switch
#!/bin/bash

val=$(defaults read com.apple.Finder AppleShowAllFiles)

if [ "$val" == "1" ]; then
	defaults write com.apple.Finder AppleShowAllFiles -string 0
	killall Finder
fi
@StudioEtrange
StudioEtrange / MacOS X El Capitan with Vagrant - MacOS X VM on Windows or Linux.md
Last active March 27, 2026 23:34
MacOS X El Capitan in a VM with Vagrant on Windows/Linux
#!/usr/bin/perl
use strict;
use warnings;
my $numArgs = $#ARGV + 1;
my @types = qw/nat mangle filter/;
if ($numArgs > 0) {@types = @ARGV;}
$SIG{INT} = sub{print "\e[?25h\e[u"; exit};
@StudioEtrange
StudioEtrange / treegen.sh
Created January 25, 2018 02:51 — forked from pravj/treegen.sh
bash script to generate tree structure of a directory
#!/usr/bin/env bash
# bash script to generate tree structure of a directory
# Pravendra Singh (@hackpravj)
pwd=$(pwd)
find $pwd -print | sed -e "s;$pwd;\.;g;s;[^/]*\/;|__;g;s;__|; |;g"
@StudioEtrange
StudioEtrange / X11 with windows client and linux server.md
Last active August 4, 2026 06:47
X11 server on linux and windows client configuration

X11 server on linux and windows client configuration

Configuration 1

Server X11 on LINUX (without any X related package) (192.168.71.126)

/etc/ssh/sshd_config
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
@StudioEtrange
StudioEtrange / github-pr-stat.sh
Created January 31, 2018 14:44
Will scan a github repo to compute some statistics on PR
#!/usr/bin/env bash
# Will scan a github repo to compute some statistics on PR
# requires curl and bc (presents on most unix like system)
# PARAMETERS ----------------------------
# Github repo to scan
GITHUB_REPO="status-im/status-react"
@StudioEtrange
StudioEtrange / lvm-commands.sh
Last active April 2, 2018 21:56
LVM and disk commands
# List block devices
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 238.5G 0 disk
├─sda1 8:1 0 200M 0 part /boot/efi
├─sda2 8:2 0 500M 0 part /boot
└─sda3 8:3 0 237.8G 0 part
├─fedora-root 253:0 0 50G 0 lvm /
├─fedora-swap 253:1 0 2G 0 lvm [SWAP]
└─fedora-home 253:2 0 185.9G 0 lvm
@StudioEtrange
StudioEtrange / is_sourced.sh
Created March 28, 2018 23:06
shell detect if sourced
# https://stackoverflow.com/a/28776166
sourced=0
if [ -n "$ZSH_EVAL_CONTEXT" ]; then
case $ZSH_EVAL_CONTEXT in *:file) sourced=1;; esac
elif [ -n "$KSH_VERSION" ]; then
[ "$(cd $(dirname -- $0) && pwd -P)/$(basename -- $0)" != "$(cd $(dirname -- ${.sh.file}) && pwd -P)/$(basename -- ${.sh.file})" ] && sourced=1
elif [ -n "$BASH_VERSION" ]; then
[ "$0" != "$BASH_SOURCE" ] && sourced=1
else # All other shells: examine $0 for known shell binary filenames
# Detects `sh` and `dash`; add additional shell filenames as needed.
@StudioEtrange
StudioEtrange / smtp_gmail
Created November 28, 2018 00:17
A note about using gmail as a relay
A note about using gmail as a relay
Gmail by default does not allow email clients that don't use OAUTH 2 for authentication (like Thunderbird or Outlook).
First you need to enable access to "Less secure apps" on your google settings.
Serveur de courrier entrant (IMAP) imap.gmail.com
SSL requis : oui
Port : 993