Skip to content

Instantly share code, notes, and snippets.

View SandeepGusain's full-sized avatar

Sandeep Gusain SandeepGusain

  • Chandigarh, India
View GitHub Profile
@SandeepGusain
SandeepGusain / archtweaks.md
Created October 29, 2022 19:24 — forked from lbrame/archtweaks.md
Tweaks I've made to my Arch Linux installation

Arch Linux tweaks

This is a collection of the tweaks and modification I've made to my Arch Linux installation over the months. These may be applicable to other distros, but please check first before doing anything. I also included Arch Wiki references for all the procedures I mentioned. My recommendation is not to blindly follow this gist but to always check with the Arch Linux wiki first. Things move fast and by the time you're reading this my gist may be out of date. Lastly, the golden rule: never execute a command you don't understand.

Installing the KDE Plasma desktop

My current DE of choice is KDE's Plasma. I find it just about perfect.

There are various ways to install it on Arch. The most popular one is to install plasma and plasma-applications, but I don't like doing that because it comes with too many programs I'll never use. I, instead, install the base plasma group, remove the few extra packages that come with it, then I finish off by installing a few KDE apps that don't come with th

@SandeepGusain
SandeepGusain / gist:98b084267327ba7c3faeb40f78e68c2d
Created April 8, 2022 13:11 — forked from hest/gist:8798884
Fast SQLAlchemy counting (avoid query.count() subquery)
def get_count(q):
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
count = q.session.execute(count_q).scalar()
return count
q = session.query(TestModel).filter(...).order_by(...)
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ...
print q.count()
@SandeepGusain
SandeepGusain / System Design.md
Created November 25, 2021 16:12 — forked from vasanthk/System Design.md
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?
@SandeepGusain
SandeepGusain / regex_golf.md
Created July 19, 2021 09:32 — forked from jonathanmorley/regex_golf.md
Best possible answers collected so far for [Regex golf](http://regex.alf.nu/). === WARNING: SPOILERS ===
@SandeepGusain
SandeepGusain / Storing-Images-On-Github.md
Created March 10, 2021 15:15 — forked from joncardasis/Storing-Images-On-Github.md
Storing Images and Demos in your Repo

Storing Images and Demos in your Repo

In this quick walkthough you'll learn how to create a separate branch in your repo to house your screenshots and demo gifs for use in your master's readme.

How to

1. Clone a fresh copy of your repo

In order to prevent any loss of work it is best to clone the repo in a separate location to complete this task.

2. Create a new branch

Create a new branch in your repo by using git checkout --orphan assets

@SandeepGusain
SandeepGusain / normalise.py
Created October 18, 2019 18:52 — forked from j4mie/normalise.py
Normalise (normalize) unicode data in Python to remove umlauts, accents etc.
# -*- coding: utf-8 -*-
import unicodedata
""" Normalise (normalize) unicode data in Python to remove umlauts, accents etc. """
data = u'naïve café'
normal = unicodedata.normalize('NFKD', data).encode('ASCII', 'ignore')
print normal