Skip to content

Instantly share code, notes, and snippets.

View khurshid-alam's full-sized avatar

Khurshid Alam khurshid-alam

View GitHub Profile
@wernight
wernight / inotifyexec.py
Last active December 17, 2024 19:33
inotifywait helper that executes a command on file change (for Linux, put it in ~/bin/)
#!/usr/bin/env python
"""Use inotify to watch a directory and execute a command on file change.
Watch for any file change below current directory (using inotify via pyinotify)
and execute the given command on file change.
Just using inotify-tools `while inotifywait -r -e close_write .; do something; done`
has many issues which are fixed by this tools:
* If your editor creates a backup before writing the file, it'll trigger multiple times.
* If your directory structure is deep, it'll have to reinitialize inotify after each change.
@Integralist
Integralist / GitHub curl.sh
Last active February 6, 2025 20:47 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@radupotop
radupotop / 20-intel.conf
Created January 24, 2014 13:21
/etc/X11/xorg.conf.d/20-intel.conf
# /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod" "uxa"
Option "TearFree" "true"
EndSection
@denji
denji / http-benchmark.md
Last active April 26, 2025 20:16
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@skynebula
skynebula / gist:8237027
Last active October 6, 2023 00:32
Just type that in your terminal to disable the default "open document" prompt window on macOS when you launch TextEdit or Writer, and to get a blank new document instead.
defaults write -g NSShowAppCentricOpenPanelInsteadOfUntitledFile -bool false
@amotoki
amotoki / ssh-agent-check.sh
Created December 27, 2013 04:41
Reuse an existing ssh-agent process
#!/bin/sh
USERNAME=`whoami`
NUM=`ps -ef | grep ssh-agent | grep -v grep | grep $USERNAME | wc -l`
if [ $NUM -eq 1 ]; then
ST=`ps -ef | grep ssh-agent | grep -v grep | grep $USERNAME`
AGENT_PID=$(echo $ST | awk '{print $2;}')
SOCKFILE=$(ls -l /tmp/ssh-*/agent.[0-9]* | grep $USERNAME | sed -e 's/^.*\(\/tmp\/ssh-.*\)/\1/')
echo "echo SOCKFILE=$SOCKFILE;"
@habibutsu
habibutsu / inotify_example.py
Created December 13, 2013 14:26
Example a work with inotify in Python
import os
import sys
import struct
from collections import namedtuple
from ctypes import\
CDLL,\
CFUNCTYPE,\
c_int,\
c_char_p,\
@scribu
scribu / README.md
Last active August 5, 2019 09:59
Convert notes from Tomboy XML to Evernote XML

This is a quick script to convert notes from Tomboy to Evernote.

Usage

pip install -r requirements.txt
mkdir export/
python tomboy-export.py <tomboy-dir>
@vdavez
vdavez / docx2md.md
Last active June 17, 2024 19:40
Convert a Word Document into MD

Converting a Word Document to Markdown in Two Moves

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

The Solution

As it turns out, there are several open-source tools that allow for conversion between file types. Pandoc is one of them, and it's powerful. In fact, pandoc's website says "If you need to convert files from one markup format into another, pandoc is your swiss-army knife." But, although pandoc can convert from markdown into .docx, it doesn't work in the other direction.

@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active January 3, 2025 03:54
5 entertaining things you can find with the GitHub Search API