Skip to content

Instantly share code, notes, and snippets.

abdalmoez / .bashrc
Created Jul 1, 2020
cygwin terminal in vsc
View .bashrc
[[ ! -z $CWD ]] && cd $CWD
View vsc-problem-solver-with-location.json
"problemMatcher": {
"base": "$gcc",
"fileLocation": ["relative", "${workspaceRoot}/builddir"]
ls -d */ | awk '{print "cd "$0" && git config core.filemode false && cd .."}' >
chmod +x
View samp-bugs-sample-commands.pwn
CMD:listbugs(playerid, params[])
if(GetFactionType(playerid) != FACTION_FEDERAL)
SendClientMessage(playerid, COLOR_GREY, "You can't use this command as you aren't a federal agent.");
return 1;
SendClientMessage(playerid, COLOR_GREEN, "Online Bugged players:");
abdalmoez / .bashrc
Last active Apr 27, 2020
My config for bashrc
View .bashrc
export HISTIGNORE=$'[ \t]*:&:[fb]g:exit' # Don't put duplicate lines in the history.
alias grep='grep --color=always' # show differences in colour
alias ls='ls -h --color=tty' # Dispaly size unit, classify files in colour
alias ll='ls -l' # long list
alias la='ls -A' # all but . and ..
alias l='ls -CF' #
alias cd.='cd ..'
alias cd..='cd ../..'
alias cd...='cd ../../..'
alias cd....='cd ../../../..'
abdalmoez / LocateFirstEmptySlotInMap.cpp
Created Apr 20, 2020
Get the first empty key in map<int, TValue>
View LocateFirstEmptySlotInMap.cpp
#include <iostream>
#include <map>
template<typename TValue>
int locateFirstAvailableSlot(std::map<int, TValue> my_map)
typename std::map<int, TValue>::iterator it;
int expected_value=1;
abdalmoez / EventCallBackForAllObjectsOfAClass.cpp
Created Apr 20, 2020
Creating Event call back for all instance of a class
View EventCallBackForAllObjectsOfAClass.cpp
#include <iostream>
#include <unordered_set>
class TestEvent {
static std::unordered_set<TestEvent*> objects;
std::string m_title;
TestEvent(const std::string& title):m_title (title)
abdalmoez / get-enum-string.cpp
Last active Feb 20, 2020
Usefull macro to convert enum to string
View get-enum-string.cpp
#include <iostream>
#define STR(p) #p
enum {
int main()
abdalmoez /
Created Jan 12, 2020
Start udp server and log received packets using python
import logging
import socket
log = logging.getLogger('udp_server')
def udp_server(host='', port=1234):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
abdalmoez /
Last active Jan 12, 2020
Send udp packet using python
import socket
UDP_IP = ""
UDP_PORT = 1234
MESSAGE = "Hello, World!"
print ("UDP target IP:", UDP_IP)
print ("UDP target port:", UDP_PORT)
print ("message:", MESSAGE)
You can’t perform that action at this time.