Skip to content

Instantly share code, notes, and snippets.

View kelixlabs's full-sized avatar

Wahyu Kecambah Linux kelixlabs

View GitHub Profile
@kelixlabs
kelixlabs / gist:4ba5cc41e424d28072703458f6c36974
Created December 4, 2021 11:51 — forked from srsbiz/gist:8373451ed3450c0548c3
php AES-128-CBC mcrypt & openssl
<?php
function encrypt_mcrypt($msg, $key, $iv = null) {
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
if (!$iv) {
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
}
$pad = $iv_size - (strlen($msg) % $iv_size);
$msg .= str_repeat(chr($pad), $pad);
$encryptedMessage = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $msg, MCRYPT_MODE_CBC, $iv);
return base64_encode($iv . $encryptedMessage);
@kelixlabs
kelixlabs / postman-deb.sh
Created May 2, 2020 21:25 — forked from SanderTheDragon/postman-deb.sh
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
ls Postman*.tar.gz > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Removing old Postman tarballs"
rm -f $(ls Postman*.tar.gz)
fi
curlExists=$(command -v curl)
@kelixlabs
kelixlabs / IPTables - Block all websites except some of them
Created August 26, 2019 08:37 — forked from paladini/IPTables - Block all websites except some of them
IPTables - Blocking all websites except a few of them.
// This isn't the final version of the script. The third may be incorrect.
iptables -I OUTPUT -p tcp -m tcp --dport 443 -j REJECT --reject-with icmp-port-unreachable // blocking https sites
iptables -I OUTPUT -p tcp -m tcp --dport 80 -j REJECT --reject-with icmp-port-unreachableBlock // blocking http sites
iptables -A OUTPUT -s 150.162.0.0/16 -j ACCEPT // accepting ips from 150.162.*.*
@kelixlabs
kelixlabs / relay-test.py
Created November 2, 2018 11:34 — forked from johnwargo/relay-test.py
Simple Python app for controlling a relay through an GPIO Zero Output device
#!/usr/bin/python
# A simple Python application for controlling a relay board from a Raspberry Pi
# The application uses the GPIO Zero library (https://gpiozero.readthedocs.io/en/stable/)
# The relay is connected to one of the Pi's GPIO ports, then is defined as an Output device
# in GPIO Zero: https://gpiozero.readthedocs.io/en/stable/api_output.html#outputdevice
import sys
import time
@kelixlabs
kelixlabs / qtrpi-cross-compile.md
Last active December 8, 2021 20:32
Cross-compiling Qt for HW accelerated OpenGL with eglfs on Raspbian and setting up Qt Creator

QT-Raspi Cross Compile

Prepare the Raspberry Pi:

Install raspbian

Get the latest raspbian image here

Enable deb-src repos

#!/bin/bash
IPTABLES=/sbin/iptables
echo " * flushing old rules"
${IPTABLES} --flush
${IPTABLES} --delete-chain
${IPTABLES} --table nat --flush
${IPTABLES} --table nat --delete-chain
@kelixlabs
kelixlabs / kubuntu-to-neon.md
Created April 5, 2017 00:15 — forked from nihathrael/kubuntu-to-neon.md
How to upgrade kubuntu 16.04 -> KDE neon

This worked for me and might not work for your.

Try it at your own risk!

Add the neon repositories and install the neon desktop

$ wget -qO - 'http://archive.neon.kde.org/public.key' | sudo apt-key add -
$ sudo apt-add-repository http://archive.neon.kde.org/user
$ sudo apt-get update
$ sudo apt-get install neon-desktop
@kelixlabs
kelixlabs / directives.php
Created December 10, 2016 10:24 — forked from fer-ri/directives.php
Laravel Blade Directive To Set Active Menu Class
<?php
Blade::directive('active', function ($expression) {
return "<?php echo active_url($expression); ?>";
});
@kelixlabs
kelixlabs / _ide_helper.php
Created August 21, 2016 03:31
A helper file for Laravel 5. Generated for Laravel 5.2.43 on 2016-08-21.
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.2.43 on 2016-08-21.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
@kelixlabs
kelixlabs / fixplymouth
Last active March 15, 2022 20:30
SCRIPT TO FIX THE UBUNTU PLYMOUTH FOR PROPRIETARY NVIDIA AND ATI GRAPHICS DRIVERS
#!/bin/bash
# ----------------------------------
# Author: D0rkye
# Homepage: http://d0rkye.zsenialis.com/
# Most code probably by kyleabaker: http://kyleabaker.com/2010/07/11/how-to-fix-your-ubuntu-boot-screen/
# Script via http://www.webupd8.org/2010/10/script-to-fix-ubuntu-plymouth-for.html
# ----------------------------------
sudo apt install v86d hwinfo -y
sudo hwinfo --framebuffer
echo "---------------------------------------------------------------"