Skip to content

Instantly share code, notes, and snippets.

View X4's full-sized avatar
🤖

X4 X4

🤖
  • Dubai, UAW
  • 17:17 (UTC +04:00)
  • X @x4aes
View GitHub Profile
@X4
X4 / check_ssl.py
Created August 8, 2021 23:22 — forked from fffonion/check_ssl.py
hosts - A mix of working google, twitter, wikipedia ips and no-ads
from socket import socket, error, setdefaulttimeout
import ssl
import re
import time
import sys
import os
from hashlib import md5
import json
os.chdir(os.path.split(sys.argv[0])[0])
@X4
X4 / sklearn-pipeline.py
Last active October 30, 2017 00:28
Building a SciKit-Learn Pipeline
# Make ML-Pipeline Runs Reproducible
random_state=7
# Testing our Pipeline with an ML-Ready Dataset
from sklearn.datasets import load_iris
iris = load_iris()
# Assign ML-Input and Ml-Target
Xi = iris.data # Input
yi = iris.target # Output
# Performs a beam search, to be run in the "Decoder"
def Beamsearch(self,
predict_fun, # RNN() with: new_states as a list, outputs of shape (batch_size, n_symbols)
states0, # RNN()'s initial layer states are equal to states0
batch_size, # Size derived from initial layer states0
start_symbol # Tagging the encoded target sequence with <S> as a start symbol for example
stop_symbol # ' ' </S> as a stop symbol for example
max_length, # Maximum length of a given sequence
beam_size=4 # See [simple beam search](https://github.com/SeitaroShinagawa/simple_beamsearch) for an example of probabilities
):
@X4
X4 / try_catch.c
Last active December 4, 2015 12:44
/* C-Standard-Libraries */
#ifndef LIBRARIES
#define LIBRARIES
#include <stdio.h> /* stdio.h — standard buffered input/output */
#include <stdlib.h> /* stdlib.h — standard library definitions */
#include <string.h> /* string.h — string operations */
#include <stdarg.h> /* stdarg.h — handle variable argument list */
#include <stdbool.h> /* stdbool.h — boolean type and values */
#include <stddef.h> /* stddef.h — standard type definitions */
@X4
X4 / kMer.hs
Last active August 29, 2015 14:23
k-mer algorithm
{-# LANGUAGE UnicodeSyntax #-}
{-
Reads: AGATCGAGTG
Prints: sorted 3-mers: AGA AGT ATC CGA GAG GAT GTG TCG
unsorted 3-mers: AGA GAT ATC TCG CGA GAG AGT GTG
-}
import Data.Function
import Data.List
@X4
X4 / nodejs-pi-setup.sh
Created March 23, 2015 20:22
Setup NodeJS on Raspberry Pi 2 in < 5 Minutes
Prerequisites:
==============
1. Raspbian
2. Raspberry Pi (2)
sudo apt-get update
sudo apt-get upgrade
cd
## Source: http://node-arm.herokuapp.com/
@X4
X4 / hidlib_enqueue_overflow.c
Last active July 14, 2016 20:04
hidlib_enqueue_overflow.c (OS X IOKit kernel code execution due to integer overflow in IODataQueue::enqueue)
/* The class IODataQueue is used in various places in the kernel. There are a couple of exploitable integer overflow issues in the ::enqueue method: */
Boolean IODataQueue::enqueue(void * data, UInt32 dataSize)
{
const UInt32 head = dataQueue->head; // volatile
const UInt32 tail = dataQueue->tail;
const UInt32 entrySize = dataSize + DATA_QUEUE_ENTRY_HEADER_SIZE; <-- (a)
IODataQueueEntry * entry;
if ( tail >= head )
@X4
X4 / autorotate.sh
Created July 14, 2014 20:52
Autorotate Touchscreen
#!/bin/bash
ERASER=$(xinput --list | grep 'eraser' | grep -o [0-9][0-9])
STYLUS=$(($ERASER+1))
TOUCH=$(xinput --list | grep 'Wacom' | grep -o [0-9][0-9] | grep -v $ERASER | grep -v $STYLUS)
#xsetwacom set $STYLUS TopX -100
#xsetwacom set $STYLUS TopY 12
#xsetwacom set $STYLUS BottomX 26170
@X4
X4 / entropy_sabayonlinux.org.txt
Last active August 29, 2015 13:57
equo repo mirrorsort sabayonlinux.org
# Repository configuration file automatically generated
# by Entropy on your behalf.
[sabayonlinux.org]
enabled = true
desc = Sabayon Linux Official Repository
repo = http://pkg.sabayon.org#bz2
repo = http://pkg.repo.sabayon.org#bz2
# Main sabayonlinux.org Repository
@X4
X4 / ua.php
Created January 29, 2014 02:09
Primitive Mobile only UA detection.
<?php
function getUA()
{
$useragent = $_SERVER['HTTP_USER_AGENT'];
$mobile_ua = '/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i';
$mobile_ua_alt = '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|i