Skip to content

Instantly share code, notes, and snippets.

View melbahja's full-sized avatar
🦇
chmod +x bits

Mohamed El Bahja melbahja

🦇
chmod +x bits
View GitHub Profile
@kylemanna
kylemanna / README-python-service-on-systemd-activated-socket.md
Last active February 7, 2024 16:26 — forked from drmalex07/README-python-service-on-systemd-activated-socket.md
An example network service with systemd-activated socket in Python. #systemd #python #socket #socket-activation

README

The example below creates a TCP server listening on a stream (i.e. SOCK_STREAM) socket. A similar approach can be followed to create a UDP server on a datagram (i.e. SOCK_DGRAM) socket. See man systemd.socket for details.

An example server

Create an simple echo server at ~/tmp/foo/serve.py.

@adliwahid
adliwahid / mirror.sh
Created April 17, 2016 10:27
httrack for mirroring site on archive.org (waybackmachine)
#this is useful for copying snapshotted sites at archive.org
#copied from http://superuser.com/questions/532036/trouble-using-wget-or-httrack-to-mirror-archived-website
#replace ${wayback_url} with the full URL i.e. http://web.archive.org/web/20020705161639/http://kict.iiu.edu.my/
#replace ${domain_name} with the domain name of the site you'r mirroring without the 'http', so kict.iiu.edu.my
httrack\
${wayback_url}\
'-*'\
'+*/${domain_name}/*'\
-N1005\
--advanced-progressinfo\
@renchap
renchap / README.md
Last active October 12, 2022 17:14
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 {
@googleinurl
googleinurl / facecheck2.0.php
Last active April 20, 2023 18:59
Verificação de usuários Facebook 2.0
<?php
/*
E d i ç ã o - 2.0 / 29-09-2015
--------------------------------------------------------------------------------
[+] AUTOR: Cleiton Pinheiro / Nick: googleINURL
[+] Blog: http://blog.inurl.com.br
--------------------------------------------------------------------------------
*/
@harlow
harlow / golang_job_queue.md
Last active April 24, 2024 10:21
Job queues in Golang
@Vestride
Vestride / encoding-video.md
Last active April 24, 2024 09:59
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@mikemackintosh
mikemackintosh / method_examples.php
Last active February 6, 2020 21:36
Audit Log Parser
<?php
// Include Parser.php - The LogAudit Source
include('Parser.php');
// Create an instance of the Auth Class
// If an argument is passed, it is expecting
// a username.
// @ $arg Not Required
$Audit = new \LogAudit\Auth('sixeightzero');
@denji
denji / golang-tls.md
Last active March 29, 2024 03:03 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@gsherwood
gsherwood / ruleset.xml
Created December 5, 2014 20:06
PSR2 with tabs instead of spaces
<?xml version="1.0"?>
<ruleset name="MyStandard">
<description>PSR2 with tabs instead of spaces.</description>
<arg name="tab-width" value="4"/>
<rule ref="PSR2">
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
@nethoncho
nethoncho / find_network_test.php
Last active November 8, 2019 00:32
PHP: Find Network and Broadcast for given IP and Subnet
#!/usr/bin/php
<?php
$input = new stdClass();
$input->ip = '70.71.72.73';
$input->netmask = '255.255.255.0';
$input->ip_int = ip2long($input->ip);
$input->netmask_int = ip2long($input->netmask);
// Network is a logical AND between the address and netmask