Skip to content

Instantly share code, notes, and snippets.

@ProGM
ProGM / connection.lua
Last active April 5, 2021 07:01
A simple connection checker for Corona SDK
---------------------------------------
-- Test connection to the internet
---------------------------------------
local socket = require("socket")
local connection = {}
local function manual_test(callback, timeout)
if timeout == nil then timeout = 1000 end
local connection = assert(socket.tcp())
connection:settimeout(0)
@ProGM
ProGM / gist:4b628044113d0b3d8d80
Created February 27, 2015 12:11
Useful shell snippets
# Delete empty folders recursively
find . -type d -empty -delete
@ProGM
ProGM / Twitter bot
Created June 3, 2015 13:52
Useful commands to manage your twitter account using t https://github.com/sferik/t
# List all leaders (people you follow that doesn't follow back) ordered by followers - followings.
# This is useful to identify people that never follow back.
t leaders -l | awk '{ print $12-$11,"\t",$13 }' | sort -k1,1nr -k2,2
# Unfollow top ten people extracted by the previous command:
t leaders -l | awk '{ print $12-$11,"\t",$13 }' | sort -k1,1nr -k2,2 | awk '{print $2}' | head -10 | xargs t unfollow
@ProGM
ProGM / find_useless_resources_unity.sh
Last active January 8, 2022 10:04
A useful script to identify Unity resource that are not referenced in the project
#!/bin/bash
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
NC='\033[0m'
rm unused_files.log &> /dev/null
grep -r . --include=\*.meta --exclude=*{Editor,Gizmos}* -e 'guid' | while read line; do
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
/* General setups */
* {
box-sizing: border-box;
}
#!/bin/bash
set -e
# Extracts all guid from an animation
extract_id_list() {
grep -o "guid: [0-9a-z]\+" $1 | grep -o "[0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z]\+" | xargs -n1 | sort -u | xargs
}
# Gives a meta file from it's guid
find_by_id() {
# Given an existing gulpfile.js without a package.json, runs `npm install`
# many times until all package required get installed
package_name=gulp
while [[ $package_name ]]; do
npm install $package_name
package_name=`gulp 2>&1 | grep "find module" | xargs | awk '{print $NF}'`
echo "Install $package_name"
done
@ProGM
ProGM / Normalize.rb
Created January 26, 2016 14:36 — forked from agb91/Normalize.rb
normalizer for urls
require 'normalize_url'
require 'rubygems'
require 'httpclient'
require 'net/http'
require 'uri'
def printer(text, value)
puts text + ": " + value.to_s
end
@ProGM
ProGM / github_issue.js
Created February 17, 2016 10:31
Create Github issue that refers to trello card
// Add this to favourites, prefixing this with "javascript:""
window.open(encodeURI("https://github.com/:NAME/:REPO/issues/new?body=\n\n----\nRefers to " + window.location.href))
@ProGM
ProGM / example.rb
Last active March 1, 2016 15:44
A patch to allow `neo4j` gem to retry when there's a `id_property` conflict.
class Article
include Neo4j::ActiveNode
include IdPropertyWithRetry
id_property :uuid, on: :id_builder, retry: 3
def id_builder
SecureRandom.urlsafe_base64(8)
end
end