Skip to content

Instantly share code, notes, and snippets.

@Yengas
Yengas / PuushMeManager.js
Last active December 25, 2015 07:19
Upgraded Puush.me Managing with Filtering and Multiple Page Deleting.Just copy this code to the Puush.me Managing Site after you login, initialize it to a variable and do whatever you want.This javascript class can:- Return Total Puush History Pages as INT- Get Puush history from pages (all of them or with filtering)- Delete Puushes only by thei…
function PuushMeManager(){
var sizeChart = {
"GB": 1024 * 1024 * 1024,
"MB": 1024 * 1024,
"KB": 1024,
"B": 1
};
this.getTotalPages = function(){
@Yengas
Yengas / HorribleSubsDownloader.js
Last active December 26, 2015 20:18
Makes torrent download from Horrible Subs easier.Usage: "Hunter x Hunter".download([10,20],720);Enable opening .torrent files after the download(an option that your browser gives you).
String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; };
Object.prototype.forEach = function(callback){ for(var i = 0; i < this.length; i++){ if(typeof this[i] == "object"){ callback(this[i]); } } };
function getElement(html){ var d = document.createElement("div"); d.setAttribute('style', 'display: none;'); d.innerHTML = html; document.body.appendChild(d); return d; }
function download(url){ var frame = document.createElement("iframe"); frame.src = url; document.body.appendChild(frame); }
String.prototype.download = function (ea, q){
var e, d, x = new XMLHttpRequest();
if(ea[0] > ea[1] || ea[0] < 0 || ea[1] <= 0 || [360,480,720,1080].indexOf(q) == -1){ return; }
for(var i = ea[0]; i <= ea[1]; i++){
e = this+" "+((i < 10) ? "0": "") + i;
x.open("GET","http://horriblesubs.info/lib/search.php?value="+encodeURIComponent(e),false);
@Yengas
Yengas / main.rb
Last active December 29, 2015 07:09
Popoizle.com arşivini indirir.
require 'net/http'
require 'json'
if (!Dir.exist?("Archive")) then Dir.mkdir("Archive"); end
@hashes = []; # Hashleri tutmak için array oluştur.
def downloadGif(uri, hash)
uri = URI(uri);
http = Net::HTTP.new(uri.host, uri.port);
@Yengas
Yengas / markAntalya.rb
Last active December 31, 2015 23:49
MarkAntalya ön panel animasyonu, basit bir yaklaşım.
array = "ABCDEFGHJKLMNOPRSTYZ".split("");
width = 5;
panel = [20,50];
sayac = 0;
length = array.count;
limit = width * length;
while (true) do
for r in 0..panel[0] do
for c in 0..panel[1] do
@Yengas
Yengas / Javascript.js
Created December 23, 2013 00:04
Youtube şarkısı bittikten sonra, bilgisayarı kapatır çünkü bilgisayarı şarkı bittikten sonra kapanıcak şekilde zamanlamak is oldschool.
var scrubber = document.getElementsByClassName("html5-scrubber-button")[0];
var interval = setInterval(function(){
if(window.parseInt(scrubber.style.webkitTransformOriginX.replace("%","")) == 100){
var ws = new WebSocket("ws://192.168.1.10:6321");
ws.onopen = function(){ ws.send("shut"); };
}
}, 5000);
@Yengas
Yengas / AltyaziDuzelt.rb
Last active August 29, 2015 13:55
Toplu olarak encoding düzeltmek için yazdığım bir kod. Verilen dizin veya dosyalardaki encoding hatalarını düzeltir. Opsiyonel olarak türkçe karakterleri, ingilizce karakterler haline getirir.
#encoding: UTF-8
#gist-url: https://gist.github.com/Yengas/8761691
@options = {
:d => [ "" ],
:t => ['txt', 'srt', 'sub'], # Dosya uzantıları
:e => ["iso-8859-9", "utf-8"], # Encoding Ayaları -> 0'dan 1'e
:r => false # Türkçe karakterleri sil
};
@total = 0;
@Yengas
Yengas / Example.md
Last active August 29, 2015 13:56
Verilen kelimeleri karıştırılmış cümleden, sözlükteki tüm kelimeler ile karşılaştırma yapıp, kombinasyonları listeleme.

Girdi:

olwdelah eb yht amne

Çıktı:

  • hallowed be thy amen
  • hallowed be thy mane
  • hallowed be thy mean
  • hallowed be thy name
@Yengas
Yengas / MultiDimensionalCombinations.md
Last active July 5, 2017 12:25
Combinations of a multidimensional array

Explanation

This algorithm, from an array like this;

example = [["there"], ["is"], ["", "no"], ["urf level"]]

creates the output of; "there is urf level" and "there is no urf level".

Warning

@Yengas
Yengas / StringCompare.md
Last active January 13, 2021 18:20
Java String comparison, differences between ==, equals, matches, compareTo

String Comparison

In this gist, i will try to explain you what is the main differences between known string comparison techniques and where to use them.

Explanation of methods

==

This is the main equality operator in Java. To summarize it, this method compares the left and right hands references to eachother and returns boolean. This means this operator returns true only if left and right variable both point at the same Object in the memory. As in most of the class comparisons, this operators is discouraged to use if you're not really intented to check if two variables point to same object.

@Yengas
Yengas / Whois.java
Created March 11, 2014 22:21
Java WHOIS protocol with TCP
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
public class Whois {
public static void main(String[] args) throws Exception {