Skip to content

Instantly share code, notes, and snippets.

class GstPluginsGood < Formula
desc "GStreamer plugins (well-supported, under the LGPL)"
homepage "https://gstreamer.freedesktop.org/"
stable do
url "https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.16.2.tar.xz"
sha256 "40bb3bafda25c0b739c8fc36e48380fccf61c4d3f83747e97ac3f9b0171b1319"
end
bottle do
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
@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 / PROGRAMMING_QUESTIONS
Last active February 10, 2018 22:36
Programming Questions
We couldn’t find that file to show.
@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 / 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 / hook_getenv.c
Created November 16, 2017 13:39
hook getenv function with LD_PRELOAD
// ltrace seems to be failing when getenv is called by shared object
// gcc -shared -fpic -ldl -o hook_getenv.so hook_getenv.c
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <limits.h>
#include <errno.h>
#include <sys/stat.h>
@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}]
@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 / 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: