Skip to content

Instantly share code, notes, and snippets.

View siddht4's full-sized avatar
💭
I may be slow to respond.

siddht4

💭
I may be slow to respond.
View GitHub Profile
#!/usr/bin/env python2.7
# dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/devices/battery_BAT0 org.freedesktop.DBus.Properties.Get string:org.freedesktop.UPower.Device string:'Percentage'
import dbus
bus = dbus.SystemBus()
bat0_object = bus.get_object('org.freedesktop.UPower',
'/org/freedesktop/UPower/devices/battery_BAT0')
bat0 = dbus.Interface(bat0_object, 'org.freedesktop.DBus.Properties')
@siddht4
siddht4 / gist:96d79441aea63f0c8e905f60ba4ae6f2
Created April 12, 2018 19:56 — forked from leostera/gist:3535568
Selenium WebDriver Python Bindings and Facebook Login
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
usr = ""
pwd = ""
driver = webdriver.Firefox()
# or you can use Chrome(executable_path="/usr/bin/chromedriver")
driver.get("http://www.facebook.org")
assert "Facebook" in driver.title
@siddht4
siddht4 / .htaccess
Created April 6, 2018 10:52 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@siddht4
siddht4 / rest-api-php.md
Created April 6, 2018 08:11
REST API Resources

REST, RESTful, REST-like API Resources

Paper

Blog posts

@siddht4
siddht4 / fix-infinality.md
Created March 23, 2018 20:16 — forked from cryzed/fix-infinality.md
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!

Screenshots

Results after following the guide as of 11.01.2017 13:08:

@siddht4
siddht4 / parse.js
Created October 24, 2017 06:24
jquery - Parse JSON with jQuery Example
/********************************** example **************************************/
var base_url = 'http://people.cs.uct.ac.za/~swatermeyer/VulaMobi/';
function example()
{
var response = "";
var form_data = {
username: username,
password: password
@siddht4
siddht4 / github_issues_to_csv.py
Created July 30, 2017 10:46 — forked from patrickfuller/github_issues_to_csv.py
Export Issues from Github repo to CSV (API v3)
"""
Exports issues from a list of repositories to individual csv files.
Uses basic authentication (Github username + password) to retrieve issues
from a repository that username has access to. Supports Github API v3.
Forked from: unbracketed/export_repo_issues_to_csv.py
"""
import argparse
import csv
from getpass import getpass
import requests
@siddht4
siddht4 / export_repo_issues_to_csv.py
Created July 30, 2017 10:46 — forked from marcelkornblum/export_repo_issues_to_csv.py
Export Issues from Github repo to CSV (API v3)
"""
This is strongly based on https://gist.github.com/unbracketed/3380407;
thanks to @unbracketed and the various commenters on the page.
I've mainly cleaned up the code into basic methods, and included the
various suggestions in the comments. Hope this is useful to someone.
Make sure you have `requests` and `csv` installed via pip then run it:
`python export_gh_issues_to_csv.py`
@siddht4
siddht4 / export_multi_repo_issues_to_csv.py
Created July 30, 2017 10:46 — forked from Kebiled/export_multi_repo_issues_to_csv.py
Export Issues from Github repo to CSV (API v3)
"""
Exports Issues from a list of repositories to individual CSV files
Uses basic authentication (Github username + password) to retrieve Issues
from a repository that username has access to. Supports Github API v3.
Derived from https://gist.github.com/Billy-/96b16b7682a19a562b277c1ab52547a5
"""
import csv
import requests
import json
@siddht4
siddht4 / index.html
Created April 20, 2017 10:21 — forked from crofty/index.html
A example of using Google Map tiles with the Leaflet mapping library - http://matchingnotes.com/using-google-map-tiles-with-leaflet
<!DOCTYPE html>
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
</head>
<body>