Skip to content

Instantly share code, notes, and snippets.

View shoukreytom's full-sized avatar
🇸🇩
Sudanese Pythonista

Shoukrey Tom shoukreytom

🇸🇩
Sudanese Pythonista
View GitHub Profile
@mgrady3
mgrady3 / testframeless.py
Created September 24, 2017 18:17
Test Qt/PyQt Frameless Window resizing with QSizeGrip
"""
Test Qt Frameless Window resizing with QSizeGrip
Maxwell Grady, September 2017.
"""
import sys
from PyQt5 import QtCore, QtWidgets
from qtmodern.styles import dark
from qtmodern.windows import ModernWindow
@r00tdaemon
r00tdaemon / Install PyQt5 on Ubuntu with python3 .md
Last active May 4, 2024 04:08
Install PyQt5 on Ubuntu with python3. Steps to set up PyQt5 (ubuntu). With python code generation

Installation

pip3 install --user pyqt5  
sudo apt-get install python3-pyqt5  
sudo apt-get install pyqt5-dev-tools
sudo apt-get install qttools5-dev-tools

Configuring to run from terminal

def delete_first(self):
deleted = self.head
if self.head:
self.head = self.head.next
deleted.next = None
return deleted
@vasanthk
vasanthk / System Design.md
Last active July 6, 2024 10:13
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@hnaoto
hnaoto / context_processors.py
Last active October 9, 2021 02:57
Write your own context processors ("global variable" in Django templates)
#Reference: https://docs.djangoproject.com/en/1.9/ref/templates/api/#writing-your-own-context-processors
#This file is in yourapp/ directory
+from .models import Foo
+
+def foo(request):
# you might need this line for unit tests
if request.user.is_authenticated and request.user.is_active:
+ count = len(Foo.objects.filter(user = request.user))
+ return {"foo_count" :count}
@UndergroundLabs
UndergroundLabs / gist:fad38205068ffb904685
Created October 3, 2015 19:46
Facebook Python Login Script
#!/home/drspock/scripts/FBInvite/bin/python
import argparse
import requests
import pyquery
def login(session, email, password):
'''
Attempt to login to Facebook. Returns user ID, xs token and
@amitsaha
amitsaha / picloud_rest.c
Last active August 15, 2022 06:35
PiCloud REST call from C using libcurl
/* Invokes a published function in PiCloud and then
retrieves the results.
Uses libcurl. Compile using the -lcurl flag.
See: http://echorand.me/2012/01/27/picloud-and-rest-api-with-c-client/
*/
#include <stdio.h>
#include <curl/curl.h>
#include <string.h>
@evildmp
evildmp / gist:3094281
Last active June 30, 2023 10:55
Set up Django, nginx and uwsgi

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@wontoncc
wontoncc / balloontip.py
Last active June 25, 2024 10:41
Balloon tip module, Python, using win32gui.
# -- coding: utf-8 --
from win32api import *
from win32gui import *
import win32con
import sys, os
import struct
import time
class WindowsBalloonTip:
@kennethreitz
kennethreitz / 0_urllib2.py
Created May 16, 2011 00:17
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()