Skip to content

Instantly share code, notes, and snippets.

View avimehenwal's full-sized avatar

Avi Mehenwal avimehenwal

View GitHub Profile
@mesuutt
mesuutt / deploy-hugo.sh
Last active January 18, 2019 09:47
bash script for deploying hugo site to github pages.
#!/bin/bash
# bash script for deploying hugo site to github pages.
# I have a two branch develop and master.
# develop branch keeps source files of my blog
# master branch keeps generated website files
# If you have unstaged or not tracked files, script adds these files to stash.
# So you unstash these changes after deploy.
@subfuzion
subfuzion / curl.md
Last active May 6, 2024 09:53
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Dhertz
Dhertz / Ubuntu_Aerial.md
Last active March 28, 2023 02:06
Quick overview of how to get Apple's new TV screensavers working on most linux systems.

Using Apple’s Aerial Screensavers on Ubuntu After coming across the [Aerial] (https://github.com/JohnCoates/Aerial) screensavers for Mac, and installing them, I decided that I had had enough of the graphics-demos of my Ubuntu Precise system. I hope to provide a simple guide on how to add them to your setup as well.

First, you need to install xscreensaver (for example with aptitude, but your distro should have it):

sudo aptitude install xscreensaver
@jorendorff
jorendorff / diff.py
Last active January 12, 2023 04:52
A primitive `diff` in 50 lines of Python. Explained here: http://pynash.org/2013/02/26/diff-in-50-lines.html
""" Usage: python diff.py FILE1 FILE2
A primitive `diff` in 50 lines of Python.
Explained here: http://pynash.org/2013/02/26/diff-in-50-lines.html
"""
def longest_matching_slice(a, a0, a1, b, b0, b1):
sa, sb, n = a0, b0, 0
runs = {}
@cheekybastard
cheekybastard / scrapy_plus_selenium_renderedpage
Created February 13, 2013 14:17
Using Scrapy with Selenium to scape a rendered page
#Using Scrapy with Selenium to scape a rendered page [Updated]
from scrapy.contrib.spiders.init import InitSpider
from scrapy.http import Request, FormRequest
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from selenium import selenium
@bortzmeyer
bortzmeyer / gist:1284249
Created October 13, 2011 13:42
The only simple way to do SSH in Python today is to use subprocess + OpenSSH...
#!/usr/bin/python
# All SSH libraries for Python are junk (2011-10-13).
# Too low-level (libssh2), too buggy (paramiko), too complicated
# (both), too poor in features (no use of the agent, for instance)
# Here is the right solution today:
import subprocess
import sys