Skip to content

Instantly share code, notes, and snippets.

View mos3abof's full-sized avatar

Mosab Ibrahim mos3abof

View GitHub Profile
╰─❯ pnpm i
 WARN  This project is configured to use v9.0.0-alpha.8 of pnpm. Your current pnpm is v9.0.6
Scope: all 20 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +3045
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 0, reused 2733, downloaded 0, added 3045, done
node_modules/postman-code-generators: Running postinstall script, failed in 1.5s
node_modules/postman-code-generators postinstall$ node npm/deepinstall.js
│ Detected package manager: yarn
@mos3abof
mos3abof / crackle_pop.py
Created January 3, 2025 15:47
CracklePop
#!/usr/bin/env python
import argparse
import json
import unittest
from typing import List
def what_to_print(number: int) -> str:
"""
@mos3abof
mos3abof / qt-fix.sh
Last active June 25, 2019 16:55
Fix qt @ version 5.5, after an accidental brew upgrade
#!/usr/bin/env bash
cd $( brew --prefix )/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
if [[ -e [email protected] ]]; then
mv [email protected] [email protected]
fi
wget -q https://raw.githubusercontent.com/Homebrew/homebrew-core/9ba3d6ef8891e5c15dbdc9333f857b13711d4e97/Formula/[email protected]
# delete line 25
@mos3abof
mos3abof / git-flow-multi-hotfix.sh
Last active August 2, 2018 11:06
Allow git-flow to have more than one hotfix branch at a time
git config --global --add gitflow.multi-hotfix true
@mos3abof
mos3abof / ps-ef.bash
Created July 3, 2018 21:46
PID 0, PID 1, and PID 2 in linux.
mosab@debian:~$ ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 22:53 ? 00:00:01 /sbin/init
root 2 0 0 22:53 ? 00:00:00 [kthreadd]
@mos3abof
mos3abof / palindrome.py
Last active April 28, 2018 19:37
Function to determine whether a string is a palindrome
def is_palindrome(s):
return all(s[i] == s[~i] for i in range(len(s) // 2))
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#@author Mosab Ahmad <[email protected]>
import os
import sys
import config
import requests
import traceback
@mos3abof
mos3abof / soundcloud-perspective.py
Created March 30, 2016 00:04
Some Soundcloud Perspective XKCD Style
import matplotlib.pyplot as plt
with plt.xkcd():
fig = plt.figure()
ax = fig.add_axes((0.1, 0.2, 0.8, 0.7))
ax.bar([-0.125, 1.0 - (5 * 0.125), 1.0 - 0.125], [10, 50, 250], 0.25)
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.xaxis.set_ticks_position('bottom')
ax.set_xticks([0, 0.5, 1])

Renaming multiple files at once in linux:

$ cd /path/to/files $ rename 's/-mIF-/-mImpFRA-/' *

<?php
/**
* A quick solution for the question in this blog post:
* http://www.thousandtyone.com/blog/EasierThanFizzBuzzWhyCantProgrammersPrint100To1.aspx
*
* Took me 30 seconds, without the comments.
*
* The problem:
* Print 100 to 1.
* You need to start with "for(int i=0;" and continue from there.