Skip to content

Instantly share code, notes, and snippets.

View danishabdullah's full-sized avatar

Danish Abdullah danishabdullah

  • Berlin, Germany
View GitHub Profile
@danishabdullah
danishabdullah / Portable_WhatsApp.md
Created August 3, 2018 13:22 — forked from milolav/Portable_WhatsApp.md
Making WhatsApp desktop application portable

Portable desktop WhatsApp

This tutorial will explain how to make WhatsApp desktop application portable on Windows platform. Maybe this can work for other platforms as well.

For this to work NodeJs and asar package are required.

Download WhatsApp package

Firstly download latest version of WhatsApp. The following link contains all Windows (x64) releases:

@danishabdullah
danishabdullah / nodupe.py
Last active April 22, 2018 09:02
Merge duplicated vcards using python. 3 to 2 autoconverted version of https://github.com/ddiguy/nodupe/blob/master/src/nodupe.py
#!/usr/bin/env python
import sys
import getopt
import re, quopri, codecs
import vobject
def parse_vcf(f):
"""
Parses a vcf string, potentially containing many vcards
@returns: A list of Contacts
@danishabdullah
danishabdullah / reclaimWindows10.ps1
Created April 18, 2018 13:49 — forked from alirobe/reclaimWindows10.ps1
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults)
##########
# Tweaked Win10 Initial Setup Script
# Primary Author: Disassembler <disassembler@dasm.cz>
# Modified by: alirobe <alirobe@alirobe.com> based on my personal preferences.
# Version: 2.12.1, 2018-03-15
# Primary Author Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
# Tweaked Source: https://gist.github.com/alirobe/7f3b34ad89a159e6daa1/
# Tweak difference:
#
# @alirobe's version is a subset focused on safely disabling telemetry, some 'smart' features and 3rd party bloat ...
@danishabdullah
danishabdullah / setup.py
Last active February 6, 2020 15:06
Pycharm Setup.py Template
from __future__ import print_function, unicode_literals
from setuptools import setup, find_packages
$Import
__author__ = "$USER"
with open("requirements.txt", 'r') as file:
requirements = file.readlines()
@danishabdullah
danishabdullah / Cast for postgres IN statement.md
Created February 11, 2016 15:28
Cast for postgres IN statement
def cast_for_in_statement(iterable):
    iterable = ["'{}'".format(n) for n in iterable]
    return "({})".format(", ".join(iterable))
@danishabdullah
danishabdullah / Get dicts for sqlalchemy core query.md
Last active February 11, 2016 15:49
Get dicts for sqlalchemy core query
def make_dicts_from_result_proxy(proxy):
    res = proxy.fetchall()
    if res:
        keys = res[0].keys()
        res = [dict(zip(keys, i.values())) for i in res]
    return res

make_dicts_from_result_proxy(engine.execute("SELECT * FROM example"))
@danishabdullah
danishabdullah / S3Storage.md
Last active February 10, 2016 13:24
Boto3 S3 helper

Following example class shows how to use boto3 to upload files to s3 using a programmable configuration

from uuid import uuid1

import boto3
from botocore.client import Config
from boto3.session import Session

class S3Storage(object):
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@danishabdullah
danishabdullah / MultiProcessingLog.py
Created June 4, 2015 11:35
Python logger for multiprocessing
import multiprocessing, threading, logging, sys, traceback
class MultiProcessingLog(logging.Handler):
def __init__(self, name, mode='w', maxsize=0, rotate=0):
logging.Handler.__init__(self)
self._handler = logging.handlers.RotatingFileHandler(name, mode, maxsize, rotate, encoding='utf-8')
self.queue = multiprocessing.Queue(-1)
t = threading.Thread(target=self.receive)
@danishabdullah
danishabdullah / delete unnecessary branches.md
Created December 5, 2014 13:55
delete unnecessary branches in git
for k in $(git branch | sed /\*/d); do 
  if [ -n "$(git log -1 --since='12 week ago' -s $k)" ]; then
    git branch -D $k
  fi
done