Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am imxdn on github.
  • I am imxdn (https://keybase.io/imxdn) on keybase.
  • I have a public key whose fingerprint is AD74 7A3B 883F 1EF8 9B82 F0E5 D58E 4635 2D31 AE6E

To claim this, I am signing this object:

@imxdn
imxdn / dns.c
Created September 2, 2018 19:16 — forked from fffaraz/dns.c
DNS Query Code in C with linux sockets
//DNS Query Program on Linux
//Author : Silver Moon (m00n.silv3r@gmail.com)
//Dated : 29/4/2009
//Header Files
#include<stdio.h> //printf
#include<string.h> //strlen
#include<stdlib.h> //malloc
#include<sys/socket.h> //you know what this is for
#include<arpa/inet.h> //inet_addr , inet_ntoa , ntohs etc
@imxdn
imxdn / bigquery_sql.txt
Created October 7, 2017 14:27
Popular DE/WM mentions on r/unixporn during past year and a half using Google BigQuery and Bokeh (Python)
WITH Category AS (
SELECT
CASE
WHEN LOWER(title) LIKE "%[%i3%]%" THEN "i3"
WHEN LOWER(title) LIKE "%[%xmonad%]%" THEN "xmonad"
WHEN LOWER(title) LIKE "%[%gnome%]%" THEN "gnome"
WHEN LOWER(title) LIKE "%[%xfce%]%" THEN "xfce"
WHEN LOWER(title) LIKE "%[%kde%]%" THEN "kde"
WHEN LOWER(title) LIKE "%[%macos%]%" THEN "macos"
WHEN LOWER(title) LIKE "%[%osx%]%" THEN "macos"
@imxdn
imxdn / display.cpp
Last active September 23, 2017 19:21
#include <iostream>
#include <cstdlib>
#include "display.hpp"
int disp_init() {
int status = 0;
// Initialize SDL
if(SDL_Init(SDL_INIT_VIDEO) < 0) {
std::cout << "Failed to initialize SDL (Error: " << SDL_GetError() << ")" << std::endl;
@imxdn
imxdn / brainfuck.cpp
Last active March 26, 2017 17:57
Brainfuck Interpreter in C++
#include <iostream>
#include <cstdint>
#include <fstream>
#include <streambuf>
#include <cstring>
#include <cstdlib>
#include <stack>
int main(int argc, char *argv[]) {
std::string program;
@imxdn
imxdn / pt-elements.csv
Last active February 7, 2017 04:42
Elements from periodic table with their names, symbols, atomic numbers, atomic weights and Pauling Electronegativities (c)
Actinium Ac 89 227 1.1
Aluminum Al 13 26.9815 1.5
Americium Am 95 243 1.3
Antimony Sb 51 121.75 1.9
Argon Ar 18 39.948
Arsenic As 33 74.9216 2.0
Astatine At 85 210 2.2
Barium Ba 56 137 0.9
Berkelium Bk 97 247 1.3
Beryllium Be 4 9.0122 1.5
@imxdn
imxdn / log.txt
Created June 25, 2016 06:57
Ycm Log
Traceback (most recent call last):
3 File "/home/aimad/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/server_utils.py", line 95, in CompatibleWithCurrentCore
4 ycm_core = ImportCore()
5 File "/home/aimad/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/server_utils.py", line 87, in ImportCore
6 import ycm_core as ycm_core
7 ImportError: libtinfo.so.5: cannot open shared object file: No such file or directory
#!/bin/sh
#
# xfce4
#
# Copyright (C) 1999, 2003 Olivier Fourdan (fourdan@xfce.org)
# Copyright (C) 2011 Guido Berhoerster (guido+xfce.org@berhoerster.name)
# Copyright (C) 2011 Jarno Suni (8@iki.fi)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
class HashTable:
def __init__(self, size):
self.size = size
self.slots = [None] * size
self.data = [None] * size
def insert(self, key, data):
hashval = self._hash(key)
if self.slots[hashval] == None:
@imxdn
imxdn / words.py
Last active February 19, 2016 06:47
A small Python program to convert an integer in range (0,9999) to its equivalent in words notation.
#
# Convert numbers to words. Not to be used to complete check books.
# @author : Aimad Ahsan
#
'''Primitives are unique words which are present when converting to
in word notation organized as a dictionary'''
primitives = {
0 : 'Zero',
1 : 'One',