Skip to content

Instantly share code, notes, and snippets.

View mrf345's full-sized avatar

Mohamed Feddad mrf345

  • UAE
View GitHub Profile
@mrf345
mrf345 / gotoSleep.el
Created April 3, 2018 16:38
Put linux to sleep if emacs idle for 1 hour
;; Put system to sleep, if emacs idle for 1 hour
(defun gotoSleep ()
(interactive)
(minibuffer-message "Going to Sleep !")
(shell-command "systemctl suspend")
)
(run-with-idle-timer (* 60 60) nil 'gotoSleep)
@mrf345
mrf345 / skeptic.bat
Created May 5, 2018 12:19
RMT trojan removal batch script for windows
@echo off
rem Latest update 13 march 2015 .. Fixing bug in retrieving files from USB
rem #head
:head
setlocal enabledelayedexpansion
:tm
rem The number of temproray files is 6
set /a sn=6
set /a an=an+1
if !an! gtr !sn! ( goto :body )
@mrf345
mrf345 / send_sms.py
Created July 26, 2018 08:12 — forked from m0rff/send_sms.py
Sending a SMS with Python and pyserial via an USB 3G Modem on pfSense/FreeBSD
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#
# Sending a SMS with Python and pyserial via an USB 3G Modem on pfSense/FreeBSD
# tested with: Huawei Technologies Co., Ltd. E620 USB Modem
# and a Telekom SIM card
import serial
from curses import ascii
import time
@mrf345
mrf345 / getUUID.js
Last active November 26, 2018 02:46
Creating anonymous UUID in JavaScript using combination of IP address and User-Agent
const getUUID = (
service='https://api.ipify.org/?format=json',
key='ip'
) => {
return new Promise(
(resolve, reject) => {
fetch(service)
.then((r) => r.json())
.then((j) => {
let r = /\D+/g
{% macro beloadingNotifier(version, beload=True, firefox="firefox", release="new release") %}
<!--
Simple macro to load beloading for fading and browser_notifier for
firefox confirmation and new release confirmation
-->
<script src="{{ url_for('static', filename='beloading.js') }}"></script>
<script src="{{ url_for('static', filename='browserNotifier.js') }}"></script>
<script type='text/javascript'>
$(document).ready(function () {
/*
@mrf345
mrf345 / form.py
Created December 6, 2018 02:27
Modified form with translation
class Touch_name(FlaskForm):
name = SelectField(coerce=str)
submit = SubmitField("Register")
def __init__(self, defLang='en', *args, **kwargs):
super(Touch_name, self).__init__(*args, **kwargs)
self.name.label = gtranslator.translate("Select one of the following options :", 'en', [defLang])
self.name.choices = [(t[0], gtranslator.translate(t[1], 'en', [defLang])) for t in [
("First option", "First option"),
("Second option", "Second option"),
@mrf345
mrf345 / second_form.py
Created December 6, 2018 02:30
Modified form without translation
class Touch_name(FlaskForm):
name = SelectField(coerce=str)
submit = SubmitField("Register")
def __init__(self, defLang='en', *args, **kwargs):
super(Touch_name, self).__init__(*args, **kwargs)
self.name.label = "Select one of the following options :"
self.name.choices = [
("First option", "First option"),
("Second option", "Second option"),
@mrf345
mrf345 / bashrc.sh
Created March 3, 2019 00:30
My bash configuration
#
# ~/.bashrc
#
source ~/.bash_prompt
export VISUAL="emacs -nw"
export EDITOR="emacs -nw"
# If not running interactively, don't do anything
@mrf345
mrf345 / .bash_prompt.sh
Created March 3, 2019 00:32
my bash prompt
#!/usr/bin/env bash
# Shell prompt based on the Solarized Dark theme.
# Screenshot: http://i.imgur.com/EkEtphC.png
# Heavily inspired by @necolas’s prompt: https://github.com/necolas/dotfiles
# iTerm → Profiles → Text → use 13pt Monaco with 1.1 vertical spacing.
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM='gnome-256color';
elif infocmp xterm-256color >/dev/null 2>&1; then
dbaeumer.vscode-eslint-1.8.2 geddski.macros-1.2.1 ms-python.python-2019.2.5558
file-icons.file-icons-1.0.16 jmfirth.vsc-space-block-jumper-1.2.2 rubymaniac.vscode-paste-and-indent-0.0.8
formulahendry.auto-close-tag-0.5.6 lfs.vscode-awesome-emacs-keymap-0.8.2 streetsidesoftware.code-spell-checker-1.6.10
formulahendry.vscode-mysql-0.3.0 monokai.theme-monokai-pro-vscode-1.1.12 wayou.vscode-todo-highlight-1.0.4