Skip to content

Instantly share code, notes, and snippets.

@antun
antun / csv2xlsx.py
Last active August 29, 2015 13:58 — forked from konrad/csv2xlsx.py
#!/usr/bin/env python
"""
FUNCTION: Converts a CSV (tab delimited) file to an Excel xlsx file.
Copyright (c) 2012, Konrad Foerstner <konrad@foerstner.org>
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all
copies.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import csv
import sys
import codecs
import pprint
from openpyxl import load_workbook
@antun
antun / migrate_users_to_paperclip.rb
Created October 2, 2012 04:44
Rails migration for switching from file_column to paperclip.
require 'fileutils'
class MigrateUsersToPaperclip < ActiveRecord::Migration
def up
# Rename the old "mugshot" column to "old_file_name", since User.mugshot will now try to do Paperclip stuff
rename_column :users, :mugshot, :old_file_name
# Rename asset directories to pluralize
File.rename("public/system/user","public/system/users")
@antun
antun / lzx.vim
Created February 23, 2013 00:30
OpenLaszlo LZX Sytax file
so $VIMRUNTIME/syntax/xml.vim
let b:current_syntax = "lzx"
syn region lzxScript start=+<script>+ end=+</script>+ extend containedin=xmlRegion contains=lzxCData,xmlTag,xmlEqual,xmlEndTag fold keepend
syn region lzxMethod start=+<method+ end=+</method>+ extend containedin=xmlRegion contains=lzxCData,xmlTag,xmlEqual,xmlEndTag fold keepend
syn region lzxEventHandler start=+\Won\w\{-}="+ end=+"+ containedin=xmlTag contains=xmlAttrib,xmlEqual,lzxScriptAttribute,lzxAttributeQuote contained keepend
syn region lzxScriptAttribute matchgroup=lzxAttributeQuote start=+="+ end=+"+ contained
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
// var _ = require('./lib/lodash');
console.log("Browserified data loaded");
console.log("If lodash works you should get a random number here: ", _.random(0,5));
},{}]},{},[1]);
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
/**
* @license
* lodash 3.10.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern -o ./lodash.js`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
@antun
antun / jsonp2json
Last active December 20, 2018 18:58
#!/usr/bin/env python
import sys
rawinput = sys.stdin.read()
output = rawinput[ rawinput.index("(") + 1 : rawinput.rindex(")") ]
print(output)
@antun
antun / index.html
Created August 21, 2019 20:39
Minimal Configure - YCC
<header class="site-header">
<!-- adding a dummy header like most sites will already have -->
<h1 class="header-title">Configure 3.134.1 <span class="configure-reference-type">YCC Test Page</span></h1>
<div class="demo-links" style="display:none">
<a href="../">other demos</a>
<a href="#">source</a>
<a href="#">download</a>
<a href="#">edit</a>
@antun
antun / testRut.js
Created April 7, 2021 16:31
Chile RUT Validation
var ruts = [
'12.678.579-8', // Valid - with extra digits
'76086428-5', // Valid
'220604497', // Valid no dash
'12531909-2', // Valid
'76.498.451-K', // Valid - with K verification number
'76086428', // Invalid missing verificationNumber
'12.678.579-7', // Invalid verificationNumber
'76.498.451-0', // Invalid verificationNumber
@antun
antun / urldecode
Last active July 15, 2022 22:35
URL unencodes (decodes) a string passed via command line
#!/usr/bin/env python
import sys, urllib
if __name__ == '__main__':
args = sys.argv[1:]
for arg in args:
print urllib.unquote( arg )