Skip to content

Instantly share code, notes, and snippets.

import platform
from os import getpid, devnull
from os.path import join, dirname, exists, abspath, isabs, basename
from subprocess import check_output
def semaphore_cleanup():
"""
Clears the zombie semaphores that left behind if the process is killed.
@Akdeniz
Akdeniz / whatsapp_phone_enumerator_floated_div.js
Created May 16, 2017 14:31
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses (floated div)
/*
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses
Floated div edition
01-05-2017
(c) 2017 - Loran Kloeze - loran@ralon.nl
This script creates a UI on top of the WhatsApp Web interface. It enumerates certain kinds
of information from a range of phonenumbers. It doesn't matter if these numbers are part
of your contact list. At the end a table is displayed containing phonenumbers, profile pics,
about texts and online statuses. The online statuses are being updated every
@Akdeniz
Akdeniz / generate_random_integer_sequence.py
Created September 8, 2017 18:16
python script to generate random integer sequence
#!/usr/bin/python
"""
Generates unique random integers.
http://preshing.com/20121224/how-to-generate-a-sequence-of-unique-random-integers/
"""
class RandomUniqueSequenceInt64:
@Akdeniz
Akdeniz / hashcombine.hpp
Created September 18, 2017 13:35
hash combine template function
// taken from http://www.boost.org/doc/libs/1_55_0/doc/html/hash/reference.html#boost.hash_combine
#include <functional>
template <class T>
inline void hash_combine( std::size_t& seed, const T& v )
{
std::hash<T> hasher;
seed ^= hasher( v ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
}
@Akdeniz
Akdeniz / regex_example.cpp
Last active November 22, 2017 12:50
simple CPP regex examples
#include <iostream>
#include <regex>
#include <sstream>
int main()
{
std::string str = "[A,B,15] [C,D,1] [C,D,2][G,H,9] [C,D,a] [C,D,9] [E,F,00177] ";
std::regex word_regex( "\\[([A-Z]),([A-Z]),(\\d+)\\]" );
// get words and check if each of them matches the regex
@Akdeniz
Akdeniz / disable_leetcode_shortcuts
Last active December 7, 2017 09:36
Prevents you accidentally running and submitting questions on leetcode.
// ==UserScript==
// @name Disable leetcode shortcuts(ctrl+' and ctrl+Enter)
// @description Prevents accidentally running and submitting questions.
// @version 0.1
// @author akdeniz
// @match https://leetcode.com/*
// @run-at document-start
// @include *
// @grant none
// ==/UserScript==
@Akdeniz
Akdeniz / PROGRAMMING_QUESTIONS
Last active February 10, 2018 22:36
Programming Questions
We couldn’t find that file to show.
@Akdeniz
Akdeniz / criticker.py
Created January 4, 2020 19:16
Adjust criticker.com movie ratings by percentile.
import xml.etree.ElementTree as ET
import http.client
import urllib.parse
import argparse
class Film:
def __init__(self, filmid, rating, percentile):
self.filmid = filmid
self.rating = rating
@Akdeniz
Akdeniz / leetcode_filter_locked
Last active May 3, 2020 23:49
In order to filter locked questions in Leetcode, install Custom Blocker chrome extention and import rule below.
[{"words":[{"word_id":17,"rule_id":1,"word":".*","is_regexp":true,"is_complete_matching":false,"is_case_sensitive":false,"is_include_href":false,"insert_date":1509556290460,"update_date":1509556290460,"delete_date":0}],"search_block_by_css":false,"hide_block_by_css":false,"rule_id":1,"title":"Problems - LeetCode","is_disabled":false,"site_regexp":"https://leetcode.com/problemset/*","example_url":"https://leetcode.com/problemset/all/?difficulty=Medium&status=Todo","site_description":"Problems - LeetCode","specify_url_by_regexp":true,"search_block_xpath":"//TR//DIV//SPAN","search_block_css":"TR I","search_block_description":"","hide_block_xpath":"//TBODY[@class=\"reactable-data\"]//TR","hide_block_css":"","hide_block_description":"","user_identifier":"164e7d1a-d68d-4d38-b51a-394eddaa6adc","global_identifier":"5a544c54-df76-492c-9d58-785d4927ac5f","block_anyway":false,"insert_date":1509551105336,"update_date":1509556446509,"delete_date":0}]
class Aalib < Formula
desc "Portable ASCII art graphics library"
homepage "https://aa-project.sourceforge.io/aalib/"
url "https://downloads.sourceforge.net/aa-project/aalib-1.4rc5.tar.gz"
sha256 "fbddda9230cf6ee2a4f5706b4b11e2190ae45f5eda1f0409dc4f99b35e0a70ee"
revision 1
bottle do
cellar :any_skip_relocation
sha256 "306da4a8cb39ef81eed8b81a7d1c1c7bd47405d8270d036dde9c07c630fa4ea3" => :catalina