Skip to content

Instantly share code, notes, and snippets.

View dhayab's full-sized avatar
👋
Hi

Dhaya dhayab

👋
Hi
View GitHub Profile
@dhayab
dhayab / script.sh
Created March 15, 2022 18:48
Convert all gif in current directory to Telegram video stickers (webm)
for FILE in *.gif; do
docker run -it --rm -v $(pwd):$(pwd) -w $(pwd) jrottenberg/ffmpeg:4.1 -i $FILE -c vp9 -b:v 0 -crf 40 -vf scale=512:-1 ${FILE/gif/webm}
; done
@dhayab
dhayab / index.html
Last active March 26, 2024 13:21
WebSocket Logger
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>WebSocket Logger</title>
<link rel="stylesheet" href="https://dhayab.github.io/luxafor-webusb/demo.css">
<style>
.console .log a {
@dhayab
dhayab / FtpLog.sh
Created March 24, 2018 12:04
Collection of miscellaneous scripts and files used in my old Netgear ReadyNAS Duo V2 NAS.
##
# Display colored FTP access and transfer log
##
#!/bin/bash
PATTERN="User (.*): Login successful|/home/ftp/([a-z0-9\/._-\&\(\)]{1,})|FTP session closed"
sudo tail -n 100 -f /var/log/proftpd.log | egrep -i "$PATTERN" --color=auto
@dhayab
dhayab / makeswap.sh
Created October 21, 2015 21:18
Creates a swapfile and sets specific parameters on Ubuntu-based cloud VMs.
#!/bin/bash
#
# Info: Creates a swapfile and sets specific parameters on Ubuntu-based cloud VMs.
# Tested with Ubuntu 14.04 on DigitalOcean.
# Based on: https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
SIZE=1G
FILE=/swapfile
if [ "$EUID" -ne 0 ]
@dhayab
dhayab / Default (OSX).sublime-keymap
Last active October 21, 2015 20:41
My Sublime Text 3 preferences and key bindings.
[
// Change key binding to open console on non-qwerty keyboards
{ "keys": ["ctrl+&"], "command": "show_panel", "args": { "panel": "console", "toggle": true } },
// Swap lines
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
// Code folding
{ "keys": ["ctrl+shift+keypad_plus"], "command": "unfold_all" },
{ "keys": ["ctrl+shift+keypad_minus"], "command": "fold_all" },
// Fix Beginning + End of line
@dhayab
dhayab / keybase.md
Created March 6, 2014 21:00
keybase.io proof of my github identity

Keybase proof

I hereby claim:

  • I am dhayab on github.
  • I am dhaya (https://keybase.io/dhaya) on keybase.
  • I have a public key whose fingerprint is E849 877A ADC4 E5C6 7A41 BB74 CA98 A8F6 815E DAAE

To claim this, I am signing this object:

@dhayab
dhayab / filters.php
Last active January 25, 2016 16:52
Laravel persistent language prefixing
<?php
App::before(function($request))
{
if ( in_array(Request::segment(1), Config::get('app.languages')) ) {
Session::put('locale', Request::segment(1));
} else {
return Redirect::to(Config::get('app.locale'));
}
if ( Session::has('locale') ) {
# Rewrite for content.
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location ~* \.php$ {
@dhayab
dhayab / gist:5715152
Last active December 18, 2015 02:59 — forked from jacekd/gist:4562959
Get language prefixing in URLs from Laravel 3 back into Laravel 4.
<?php
/*
* Multilingual URLs in Laravel 4
*/
//config/app.php
return array(
...