Skip to content

Instantly share code, notes, and snippets.

@msfayed
msfayed / LogFile.udl.xml
Created March 15, 2022 14:48 — forked from mmdemirbas/LogFile.udl.xml
Custom log file syntax highlighting for Notepad++
<NotepadPlus>
<UserLang name="LogFile" ext="log">
<Settings>
<Global caseIgnored="yes" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">[(0])0</Keywords>
<Keywords name="Folder+"></Keywords>
@msfayed
msfayed / cross-origin-local-storage.js
Created March 2, 2022 14:27 — forked from buren/cross-origin-local-storage.js
Cross origin local storage sharing example (using an iframe and postMessage)
const CrossOriginLocalStorage = function(currentWindow, iframe, allowedOrigins, onMessage) {
this.allowedOrigins = allowedOrigins;
let childWindow;
// some browser (don't remember which one) throw exception when you try to access
// contentWindow for the first time, it works when you do that second time
try {
childWindow = iframe.contentWindow;
} catch(e) {
childWindow = iframe.contentWindow;
@msfayed
msfayed / cloudflare-ddns-update.sh
Created February 9, 2022 19:47 — forked from Tras2/cloudflare-ddns-update.sh
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
@msfayed
msfayed / install_boot2docker_2_hadrdisk.txt
Created April 5, 2020 14:43 — forked from ochinchina/install_boot2docker_2_hadrdisk.txt
install boot2docker to harddisk in the virtualbox
1, create a virtual machine from the virtualbox with VDI harddisk
2, add a virtual CDROM to the virtual machine and select boot2docker.iso ( the boot2docker.iso should be downloaded before)
3, start the virtual machine
4, write the boot2docker.iso image to the virtual harddisk using dd command
# dd if=/dev/cdrom of=/dev/sda
@msfayed
msfayed / Dockerfile
Last active April 1, 2020 09:09 — forked from udkyo/Dockerfile
Basic container for X11 forwarding goodness
FROM ubuntu
RUN apt update \
&& apt install -y firefox \
openssh-server \
xauth \
&& mkdir /var/run/sshd \
&& mkdir /root/.ssh \
&& chmod 700 /root/.ssh \
&& ssh-keygen -A \
&& sed -i "s/^.*PasswordAuthentication.*$/PasswordAuthentication no/" /etc/ssh/sshd_config \
@msfayed
msfayed / FindInFiles.linq
Created April 22, 2019 12:32 — forked from daryllabar/FindInFiles.linq
LinqPad Find Text in File
void Main()
{
var searchWord = "TextToSearchFor";
var searchPattern = "*.js";
var sourceFolder = @"C:\_Dev\TFS\MyProject\Source\";
var defaultProgram = @"C:\Program Files (x86)\Notepad++\notepad++.exe";
List<string> allFiles = new List<string>();
var fileCount = 0;