Skip to content

Instantly share code, notes, and snippets.

View nojvek's full-sized avatar

Noj Vek nojvek

View GitHub Profile
@nojvek
nojvek / spaces2tabs.py
Created June 27, 2012 11:40
Convert Spaces to Tabs
import os
import re
#whatever filter you would like to apply
os.system('find * -type f | egrep -v ".svn" | egrep "\.(js|mustache|css|html|txt|less|sass|as|cfml|mxml)$" > /tmp/sourcefiles.txt')
with open('/tmp/sourcefiles.txt') as f:
files = f.read().strip().split("\n")
for file in files:
@nojvek
nojvek / PNGAlphaTrim.py
Created July 19, 2012 06:27
Trim transparency of all PNG files in a folder
import Image
import sys
import glob
# Trim all png images with alpha in a folder
# Usage "python PNGAlphaTrim.py ../someFolder"
try:
folderName = sys.argv[1]
except :
@nojvek
nojvek / Tinder Auto-liker
Last active November 12, 2021 18:28
Tinder Auto-liker script
<?php
// Licence: WTFPL ! http://www.wtfpl.net/about/
$fbAuth = array("facebook_id" => "123456789", "facebook_token" => "<Use charles proxy to do man-in-middle SSL sniffing and extract fb token>");
// Do the magic.
$tinderToken = tinderCall("auth", "token", $fbAuth); // Authenticate
$authToken = "X-Auth-Token: $tinderToken\r\nAuthorization: Token token=\"$tinderToken\"\r\n";
@nojvek
nojvek / ObjUtils.watch
Last active August 29, 2015 14:15
Simple javascript Object.watch
/*
MIT Licence
Copyright © 2015 Noj Vek
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
@nojvek
nojvek / dome2jade.js
Last active September 3, 2017 03:07
dom2jade.coffee - Select DOM element in Chrome debugger, export it to jade
// Usage: copy(dom2jade($0, 0))
// copy copies to clipboard, $0 is selected elem in dev tools, 0 is pre-indent needed
// The beauty about this is that it lets the browser handle quirky html
const dom2jade = function(elem, numIndents = 0) {
const dom2tree = function(elem) {
let text;
if ((elem.nodeType === document.TEXT_NODE) && (elem.nodeValue.trim() !== "")) {
text = elem.nodeValue.trim();
@nojvek
nojvek / watchAndReload.js
Last active September 25, 2015 01:25
LiveReload CSS
// Watch for changes and auto-reload
// CSS changes get auto injected, js changes reload current page
var pollInterval = 2; // check every 2 seconds
var jsMap = {"powerbi.js":null, "powerbicommon.js":null};
var cssMap = {"powerbi.css":null, "powerbicommon.css": null};
function getLastModifiedTime(url, callback) {
$.ajax({
type: "HEAD", // HEAD only gives headers, a lot faster
url: url,
fs = require 'fs'
XXHash = require 'xxhash'
path = require 'path'
#dive = require 'dive'
HashStream = XXHash.Stream
c = console
startTime = Date.now()
mapFileName = 'pbix.json'
rootDir = '../pbix'
fs = require 'fs'
readline = require 'readline'
path = require 'path'
c = console
###
# Helpers
###
parseCliForPath = ->
@nojvek
nojvek / ufw.sh
Created April 17, 2016 18:38
Ubuntu Firewall Setup
sudo apt-get install ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow 9000
sudo ufw allow 9001
sudo ufw allow 9002
sudo ufw status verbose
#sudo ufw enable
{
"air + air": "pressure",
"air + cloud": "sky",
"air + dinosaur": "pterodactyl",
"air + earth": "dust",
"air + egg": "bird",
"air + energy": "wind",
"air + fire": "energy",
"air + lava": "stone",
"air + life": "bird",