Skip to content

Instantly share code, notes, and snippets.

View nohponex's full-sized avatar
🌪️
Accidentally practising Discordianism

Xenofon Spafaridis nohponex

🌪️
Accidentally practising Discordianism
View GitHub Profile
@nohponex
nohponex / remove-facebook.com-messenger-ad.user.js
Last active October 10, 2016 20:34
Remove messenger ad from facebook.com
// ==UserScript==
// @name Remove message ad from facebook.com
// @namespace https://nohponex.gr/script/remove-facebook.com-messanger-ad/
// @include https://www.facebook.com/*
// @version 0
// @grant none
// @run-at document-end
// @noframes
// @updateUrl https://gist.github.com/nohponex/946b1e0e65c97b213702d25e05bb35ed/raw/
// ==/UserScript==
@nohponex
nohponex / flattenExceptionBacktrace.php
Created January 8, 2016 20:10 — forked from Thinkscape/flattenExceptionBacktrace.php
Make any PHP Exception serializable by flattening complex values in backtrace.
<?php
function flattenExceptionBacktrace(\Exception $exception) {
$traceProperty = (new \ReflectionClass('Exception'))->getProperty('trace');
$traceProperty->setAccessible(true);
$flatten = function(&$value, $key) {
if ($value instanceof \Closure) {
$closureReflection = new \ReflectionFunction($value);
$value = sprintf(
'(Closure at %s:%s)',
@nohponex
nohponex / git-help.md
Last active January 8, 2016 19:35
git commands and snippets
@nohponex
nohponex / fstab
Last active October 2, 2016 07:04
fstab
#sudo apt-get install cifs-utils
#sudo vim /etc/fstab
#sudo mkdir /media/osmc
#sudo mkdir /media/osmc/eXternal
#vim /home/nohponex/.smbcredentials
#username=msusername
#password=mspassword
#chmod 600 ~/.smbcredentials
//192.168.2.7/external /media/osmc/eXternal cifs credentials=/home/nohponex/.smbcredentials,iocharset=utf8,sec=ntlm,uid=1000,gid=1000,users 0 0
@nohponex
nohponex / statistics_per_year.user.js
Last active April 27, 2019 21:34
sis.auth.gr - Statistics per year
// ==UserScript==
// @name sis.auth.gr - Statistics per year
// @namespace nohponex
// @author NohponeX
// @description sis.auth.gr - Statistics per year
// @include https://sweng.it.auth.gr/unistudent/stud_CResults.asp*
// @include https://sw*.eng.auth.gr/unistudent/stud_CResults.asp?studPg=1*
// @updateURL https://gist.github.com/NohponeX/d0671d06251ef8970caa/raw/7b991c285dd43db116ac3c6297b2143d21b728ba/statistics_per_year.user.js
// @version 1
// @grant none
@nohponex
nohponex / observer.js
Created July 7, 2015 19:15
observer.js
var c = function() {
this.onLoad = [];
};
c.prototype.onLoadSubscribe = function(fn) {
this.onLoad.push(fn);
};
c.prototype.unsubscribe = function(fn) {
this.onLoad = this.onLoad.filter(
@nohponex
nohponex / execution_time.c
Created May 28, 2015 08:16
execution_time.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char **argv){
struct timeval startwtime, endwtime;
gettimeofday (&startwtime, NULL);
//code here
@nohponex
nohponex / repeat.js
Created May 3, 2015 16:50
Repeat strings's letters
string = "";
String.prototype.repeat = function( num )
{
return new Array( num + 1 ).join( this );
};
"αβγδεζηθικλμνξοπρστυφχψω".split('').forEach(function(l) { string+= l.repeat(179) + "\n"; });
console.log(string)
@nohponex
nohponex / get_videos_from_topic.js
Last active August 29, 2015 14:20
GET all videos on SMF topic
/**
* Tested on theme Scribbles2
*/
/**
* @param DOMParser doc DOM document
* @return array Returns all youtube video ids inside a DOM document
*/
var parse_videos = function(doc) {
var embeds = doc.querySelectorAll('.post embed');
function cartesian() { //http://stackoverflow.com/a/15310051/2255129
var r = [], arg = arguments, max = arg.length-1;
function helper(arr, i) {
for (var j=0, l=arg[i].length; j<l; j++) {
var a = arr.slice(0); // clone arr
a.push(arg[i][j])
if (i==max) {
r.push(a);
} else
helper(a, i+1);