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 / 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 / Multiple PHP versions on Archlinux.md
Created September 29, 2015 06:07 — forked from petarov/Multiple PHP versions on Archlinux.md
Multiple PHP versions on Archlinux

This describes the steps required to configure multiple PHP versions on your development system, if you have issue using the AUR package. Normally one may install the AUR package on a custom path, .e.g, /usr/local/php, but if you are like me having some issues with that you might want to try a custom compile.

Pay attention to step 6) as this is where any required extensions are enabled. For this setup we generally need pdo and mysql extensions.


  1. Download PHP version 5.3.13 (or any version that you are interested in) from http://php.net/releases/

  2. Download the php53 AUR package from https://aur.archlinux.org/packages/php53/

<?php
/**
* An helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.0.16 on 2015-03-16.
*
* @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
<?php
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated for Laravel 4.2.16 on 2014-12-24.
*
* @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
/**
* author Remy Sharp
* url http://remysharp.com/tag/marquee
*/
(function ($) {
$.fn.marquee = function (klass) {
var newMarquee = [],
last = this.length;