Skip to content

Instantly share code, notes, and snippets.

View lostplesed's full-sized avatar

lost plesed lostplesed

View GitHub Profile
@lostplesed
lostplesed / compress_png_r
Last active November 30, 2017 20:59
use tinypng api to compress png file in a directory
require "net/https"
require "uri"
uri = URI.parse("https://api.tinypng.com/shrink")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
dir = Dir.pwd
#!/bin/bash
# http://thegreyblog.blogspot.com/2010/09/shell-script-to-find-and-remove-bom.html
set -o nounset
set -o errexit
DELETE_ORIG=true
DELETE_FLAG=""
@lostplesed
lostplesed / gist:6a259fa2230fd5d516f5
Created November 13, 2015 11:48
uninstall_node.sh
#!/bin/sh
(( ${#} > 0 )) || {
echo 'DISCLAIMER: USE THIS SCRIPT AT YOUR OWN RISK!'
echo 'THE AUTHOR TAKES NO RESPONSIBILITY FOR THE RESULTS OF THIS SCRIPT.'
echo "Disclaimer aside, this worked for the author, for what that's worth."
echo 'Press Control-C to quit now.'
read
echo 'Re-running the script with sudo.'
echo 'You may be prompted for a password.'
sudo ${0} sudo
@lostplesed
lostplesed / install_mono.sh
Created July 20, 2016 11:46 — forked from andreazevedo/install_mono.sh
Install mono on centOS 6.x
$ yum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2-devel libgdi* libexif glibc-devel urw-fonts java unzip gcc gcc-c++ automake autoconf libtool make bzip2 wget
$ cd /usr/local/src
$ wget http://download.mono-project.com/sources/mono/mono-3.2.8.tar.bz2
$ tar jxf mono-3.2.8.tar.bz2
$ cd mono-3.2.8
@lostplesed
lostplesed / git checkout-all-branches.sh
Created September 21, 2018 11:01
git checkout-all-branches
#!/bin/bash
#Whenever you clone a repo, you do not clone all of its branches by default.
#If you wish to do so, use the following script:
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do
git branch --track ${branch#remotes/origin/} $branch
done
@lostplesed
lostplesed / AStar.cs
Created March 29, 2019 15:49
AStar c#
using System;
using System.Collections;
using System.Collections.Generic;
namespace AStar
{
public class Point
{
public int x;
public int y;