Skip to content

Instantly share code, notes, and snippets.

View SMUsamaShah's full-sized avatar
🎯
Focusing ... almost

Muhammad Usama SMUsamaShah

🎯
Focusing ... almost
View GitHub Profile
@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@craigminihan
craigminihan / gist:b23c06afd9073ec32e0c
Last active September 21, 2023 12:47
Build GCC 4.9.2 for C/C++ on CentOS 7
sudo yum install libmpc-devel mpfr-devel gmp-devel
cd ~/Downloads
curl ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.bz2 -O
tar xvfj gcc-4.9.2.tar.bz2
cd gcc-4.9.2
./configure --disable-multilib --enable-languages=c,c++
make -j 4
make install
@stefanschmidt
stefanschmidt / epub2pdf.sh
Created May 24, 2015 23:32
Convert from EPUB to PDF format
# depends on Calibre (http://calibre-ebook.com)
# the CSS snippet prevents images from filling the page
# adapt margins, page size and font size as needed
ebook-convert doc.epub doc.pdf \
--smarten-punctuation \
--pretty-print \
--preserve-cover-aspect-ratio \
--insert-blank-line \
--margin-top 60 \
--margin-left 60 \
@jbinto
jbinto / getTitleNative.js
Created January 13, 2016 07:32
Get title from remote HTML URL - without jQuery
// Only using native browser features (no jQuery).
// Uses `fetch`, `DOMParser` and `querySelectorAll`.
const getTitle = (url) => {
return fetch(`https://crossorigin.me/${url}`)
.then((response) => response.text())
.then((html) => {
const doc = new DOMParser().parseFromString(html, "text/html");
const title = doc.querySelectorAll('title')[0];
return title.innerText;
@thomasdarimont
thomasdarimont / spinning-cube.html
Last active April 10, 2024 20:45
Spinning Cube with HTML5, Canvas, JS
<!doctype html>
<html>
<head>
<title>Spinning Cube</title>
<script type="text/javascript">
function Point3D(x,y,z) {
this.x = x;
@blaulan
blaulan / trakt.py
Created April 18, 2017 03:28
remove trakt.tv duplicate history
# -*- coding: utf-8 -*-
# @Author: Yue Wu <me@blaulan.com>
# @Date: 2017-04-01 19:32:32
# @Last Modified by: Yue Wu
# @Last Modified time: 2017-04-17 23:24:13
import json
import requests
@dikiaap
dikiaap / git-io-custom-url.md
Last active June 19, 2024 01:26
git.io custom URL

Update: As of 11 January 2022, git.io no longer accepts new URLs.

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
# python3 version, derived from python2 version https://gist.github.com/dergachev/7028596
#
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python3 simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
@palashkulsh
palashkulsh / epub_to_pdf
Last active August 11, 2021 22:35
how to convert epub to pdf
sudo apt-get install calibre
ebook-convert file.epub file.pdf