Skip to content

Instantly share code, notes, and snippets.

View lidio601's full-sized avatar

Fabio Cigliano lidio601

View GitHub Profile
@Evanion
Evanion / build_number.js
Last active September 12, 2022 19:20
Build number hook
#!/usr/bin/env node
// Based on the 'replace text' hook found here: http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/
// This hook should be placed in the 'after_prepare' hook folder.
// The hook relies on a JSON file located at '<project_root>/resources/.build.json' to track the build number.
// build.json content:
// {"build: 1}
// Add 'BUILDNR' to the version number in the '<project_root>/config.xml' file.
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@tripleee
tripleee / git-wrapper
Last active September 11, 2022 12:29
git-wrapper to protect against accidental usage of a global user.email
#!/bin/sh
:<<'=cut'
=head1 NAME
git-wrapper - avoid committing as you@invalid
=head1 SYNOPSIS
UserInterfaceState.xcuserstate
Thumbs.db
*~
.git
.DS_Store
*.xcuserdatad
UserInterfaceState.xcuserstate
@lidio601
lidio601 / convertMOD.py
Last active August 29, 2015 14:01
convert MOD+MOI video to AVI. In this case I need to convert my video camera output files (*.MOD + *.MOI) to AVI files to save disk space and have a more useful video format.
#!/usr/bin/python
# Script to import video from Panasonic SDR-H20 Camera
# This script is the same as SDCopy.exe utility in Windows
# Script copies mod files, renames them to "YYYY-MM-DD HH-MM.mpg" pattern, where "YYYY-MM-DD HH-MM" is creation time
# Script also can optionally set aspect ratio flag
# Made by m0sia (m0sia@plotinka.ru)
# Modified by lidio601
import os
#!/bin/sh
#
# � 2010 Western Digital Technologies, Inc. All rights reserved.
#
# monitorVolume.sh
# Note: this is called by cron
#
#
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
@SavvyGuard
SavvyGuard / botos3upload.py
Last active February 8, 2023 14:56
Use boto to upload directory into s3
import boto
import boto.s3
import os.path
import sys
# Fill these in - you get them when you sign up for S3
AWS_ACCESS_KEY_ID = ''
AWS_ACCESS_KEY_SECRET = ''
# Fill in info on data to upload
@emil2k
emil2k / Connectivity.java
Last active December 22, 2023 06:03
Android utility class for checking device's network connectivity and speed.
/*
* Copyright (c) 2017 Emil Davtyan
*
* 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:
@lamogura
lamogura / nslog_macros.h
Created December 8, 2012 16:36
NSLog() Macros for iOS Development
// ***note*** this is ARC enabled code
// DLog will output like NSLog only when the DEBUG variable is set
// ALog will always output like NSLog
// ULog will show the UIAlertView only when the DEBUG variable is set
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
@tmcw
tmcw / togeo.py
Created August 11, 2012 18:53
geo-assign any arbitrary image to a geotiff usable in tilemill
import subprocess
import sys, re
MERC = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'
infile = sys.argv[1]
info_output = subprocess.Popen(['gdalinfo', infile], stdout=subprocess.PIPE).communicate()[0]
size_is_re = re.compile('Size is (?P<width>\d+), (?P<height>\d+)')
size_is = filter(lambda x: x, map(lambda x: size_is_re.match(x), info_output.split('\n')))