Skip to content

Instantly share code, notes, and snippets.

View n1chre's full-sized avatar
💯

Filip Hrenić n1chre

💯
View GitHub Profile
@n1chre
n1chre / diglog-task.php
Last active January 8, 2017 23:16
Assignment for lab exercise, students had to solve it
<?php
function _die($msg)
{
echo "<html><body><h1>$msg</h1><a href='/'>Početna stranica</a></body></html>";
die;
}
if (!isset($_SERVER['REQUEST_METHOD'])) {
_die('Nece ici');
@n1chre
n1chre / iTerm2 Here.applescript
Last active January 15, 2025 08:48 — forked from jonschlinkert/open-iterm-from-finder.md
Add an icon to your finder toolbar to open iTerm2 in the current folder.
(*
Open Terminal Here
Written by Brian Schlining
source: http://hohonuuli.blogspot.hr/2016/02/iterm2-version-3-open-iterm-here-script.html
*)
property debug : false
-- when the toolbar script icon is clicked
--
@n1chre
n1chre / UnionFind.java
Created January 31, 2017 18:20
Union find with path compression and weighted union
package hruntek;
/**
* Union find with path compression and weighted union
* O(log*N) operations
*/
class UnionFind {
/**
* Node's id
@n1chre
n1chre / fer-mail.conf
Created March 12, 2017 14:23
Scripts for sending emails to FER students
[user]
username: [email protected]
password: **********
[smtp]
server: smtp.office365.com
port: 587
tls: true
@n1chre
n1chre / rbtree.erl
Last active March 30, 2017 07:45
Implementation of a red black tree in Erlang, guided by Sedgewick's paper
%%%-------------------------------------------------------------------
%%% @author fhrenic
%%% @copyright (C) 2017, FER
%%% @doc
%%%
%%% @end
%%% Created : 27. Mar 2017 00:01
%%%-------------------------------------------------------------------
-module(rbtree).
-author("fhrenic").
@n1chre
n1chre / binary_palindrome.c
Last active April 19, 2017 19:22
Check if a number is its own binary palindrome
int is_binary_palindrome(int x){
int b = 0, _x = x;
while (_x) {
b <<= 1;
b |= _x&1;
_x >>= 1;
}
return x==b;
}
@n1chre
n1chre / .htaccess
Created May 1, 2017 17:04 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Replacer {
public static void main(String[] args) {
Replacer replacer = new Replacer();
package hrucc;
import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
/**
* This class should be used when some object is producing stuff for some consumer and consume() is
@n1chre
n1chre / tmux.cheat
Created October 1, 2017 15:12 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &