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 / scrapping_project_1.py
Created January 22, 2018 06:32
a simple way to extarct data and dump as json/csv
# -*- coding: utf-8 -*-
import json,os,csv
from bs4 import BeautifulSoup
_kurl=['IncomeSlab','IncomeSource','SalariedJob','HouseOwnershipStatus','HouseType','Exclusion','Inclusion','Deprivation']
_sfolder_2=['All Category','SC Category','ST Category','Other Category','Female Headed Category','Disable Member Category']
with open("json/district/district_main.json") as f:
_d1 = json.load(f)
for _ab in _kurl: # dir 1
for _ac in _sfolder_2: # sub directory
_data=[]
@siddht4
siddht4 / web_scrap.py
Last active December 26, 2017 16:33
web scraping/mining simple
# -*- coding: utf-8 -*-
import requests
def webber(url):
headers = {"User-Agent": " "} # any user agent
post={
# basically the post data/dictionary
}
r = requests.post(url = url, data = post,headers=headers)
@siddht4
siddht4 / crude_hack
Last active December 26, 2017 16:13
dictionary_to csv
# -*- coding: utf-8 -*-
import re,csv
_csv_file="VIEWSTATE.csv"
file = open('main.txt' , 'r')
csv = open(_csv_file, "w")
columnTitleRow = "val,name\n"
csv.write(columnTitleRow)
_a=''
@siddht4
siddht4 / index.html
Created October 25, 2017 07:58
Styled JavaScript Countdown Clock
<h1>Countdown</h1>
<div id="container">
<div>
<span class="days"></span>
<div class="smalltext">Days</div>
</div>
<div>
<span class="hours"></span>
<div class="smalltext">Hours</div>
</div>
@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