Skip to content

Instantly share code, notes, and snippets.

View juhnny5's full-sized avatar
:shipit:

Julien Briault juhnny5

:shipit:
View GitHub Profile
#!/usr/bin/env bash
#: Your comments here.
set -o errexit
set -o nounset
set -o pipefail
work_dir=$(dirname "$(readlink --canonicalize-existing "${0}" 2> /dev/null)")
readonly conf_file="${work_dir}/script.conf"
readonly error_reading_conf_file=80
readonly error_parsing_options=81
readonly script_name="${0##*/}"
#!/bin/sh
#
# Sync music from Linux to iPhone using libimobiledevice + ifuse
# Only works with apps that can read songs from iTunes file sharing (e.g. Doppi)
set -euo pipefail
if [ $# -ne 1 ]; then
echo "usage: $0 <src dir>"
exit 1
@lukas2511
lukas2511 / meraki-init.sh
Last active April 15, 2024 11:34
Meraki MS220-8P config without cloud bullshit
#!/bin/sh
# This script configures a meraki ms220-8p switch completely from scratch
# See https://leo.leung.xyz/wiki/Meraki_MS220-8P for rooting instructions
# You can keep config and config.local completely empty, but i'd recommend to add a configuration
# which isolates all ports from each other.
# Without that you might have switching loops on bootup (unlikely since STP keeps longer to initialize
# than it takes this script to take over, but it just feels cleaner).
@rylev
rylev / learn.md
Created March 5, 2019 10:50
How to Learn Rust

Learning Rust

The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.

Warning

Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.

The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.

# Pull the necessary images:
docker pull nathanleclaire/curl:latest
docker pull openjdk:8u111-jre-alpine

# Start the controller container, note that it has RW access to the Docker API socket:
docker run \
  -ti \
  --rm \
@grihabor
grihabor / Makefile.version
Last active April 24, 2024 18:18
Makefile to use for incremental semantic versioning
MAKE := make --no-print-directory
DESCRIBE := $(shell git describe --match "v*" --always --tags)
DESCRIBE_PARTS := $(subst -, ,$(DESCRIBE))
VERSION_TAG := $(word 1,$(DESCRIBE_PARTS))
COMMITS_SINCE_TAG := $(word 2,$(DESCRIBE_PARTS))
VERSION := $(subst v,,$(VERSION_TAG))
VERSION_PARTS := $(subst ., ,$(VERSION))
@alexishida
alexishida / nginx-config-auth-cert-ssl.md
Last active April 30, 2024 12:18
Tutorial to configure Nginx client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Original: https://gist.github.com/mtigas/952344

Convert SSL certificate from CRT format to PEM

openssl x509 -in server.crt -out server.der -outform DER
openssl x509 -in server.der -inform DER -out server.pem -outform PEM
@eltonvs
eltonvs / arch_installation.md
Last active March 13, 2024 17:51
Arch Linux step to step installation guide

Arch Linux Installation Guide

This guide will show step-by-step how to Install Arch Linux on UEFI mode.

Table of Contents

  • Bootable Flash Drive
  • BIOS
  • Pre installation
    • Set Keyboard Layout
    • Check boot mode
  • Update System Clock
@jgamblin
jgamblin / antiautosploit.py
Last active June 1, 2023 01:57
Blocks Shodan IPs From Scanning Your Servers.
#!/usr/bin/python3
import os
shodan = ["104.131.0.69", "104.236.198.48", "155.94.222.12","155.94.254.133", "155.94.254.143", "162.159.244.38", "185.181.102.18", "188.138.9.50", "198.20.69.74", "198.20.69.98", "198.20.70.114", "198.20.87.98", "198.20.99.130", "208.180.20.97", "209.126.110.38", "216.117.2.180", "66.240.192.138", "66.240.219.146", "66.240.236.119", "71.6.135.131", "71.6.146.185", "71.6.158.166", "71.6.165.200", "71.6.167.142", "82.221.105.6", "82.221.105.7", "85.25.103.50", "85.25.43.94", "93.120.27.62", "98.143.148.107", "98.143.148.135"]
for ip in shodan:
os.system("iptables -A INPUT -s {} -j DROP".format(ip))
@bamoo456
bamoo456 / main.go
Last active August 8, 2023 07:41
[Golang] execute long running job and streaming the realtime output
func main() {
cmd := exec.Command("sh", "-c", "cd ../../bin/worker; ./run.sh")
// some command output will be input into stderr
// e.g.
// cmd := exec.Command("../../bin/master_build")
// stderr, err := cmd.StderrPipe()
stdout, err := cmd.StdoutPipe()
if err != nil {
fmt.Println(err)
}