Skip to content

Instantly share code, notes, and snippets.

View ludndev's full-sized avatar
💭
I may be slow to respond.

Judicaël AHYI ludndev

💭
I may be slow to respond.
View GitHub Profile
@ludndev
ludndev / canonical.php
Last active September 7, 2019 03:08
Generate canonical url with PhP
<?php
// get the rigth protocol
$protocol = !empty($_SERVER['HTTPS']) ? 'https' : 'http';
// simply render canonical base on the current http host ( multiple host ) + requests
echo $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
?>
@ludndev
ludndev / useful-git-command
Created September 14, 2019 22:58
Useful Git Command
**Create a Branch**
git branch branch-name
**Checkout a Branch**
( _git checkout command switch branches or restore working tree files_ )
git checkout branchname
@ludndev
ludndev / pdo_db.php
Created March 27, 2020 14:21 — forked from bradtraversy/pdo_db.php
PDO Class
<?php
/*
* PDO DATABASE CLASS
* Connects Database Using PDO
* Creates Prepeared Statements
* Binds params to values
* Returns rows and results
*/
class Database {
private $host = DB_HOST;
@ludndev
ludndev / jwtRS256.sh
Created April 17, 2020 11:15 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@ludndev
ludndev / PhonecallReceiver.java
Created May 28, 2020 10:53 — forked from ftvs/PhonecallReceiver.java
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
@ludndev
ludndev / Dockerfile
Created June 20, 2020 21:25
webserver based on debian
FROM debian:latest
RUN apt-get update -yq \
&& apt-get install apache2 apache2-utils -yq \
&& apt-get clean -y
ADD ./server/ /server/
RUN chmod +x /server/config.sh
# create docker image
docker build -t webserver:latest .
# run it
docker run -itd webserver:latest --name container_name
```php
class Test
{
public $bar = "World";
public function hello() {
return [
"Hello {$this->bar}"
];
http://www.techtrick.in/description/4595-how-to-make-kali-linux-full-screen-in-vmware
@ludndev
ludndev / HowToOTG.md
Created August 29, 2020 07:58 — forked from gbaman/HowToOTG.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int