Skip to content

Instantly share code, notes, and snippets.


Hugo Manrique hugmanrique

View GitHub Profile
View install-git-cmd-only.ps1
if(!(Get-Command git -ErrorAction SilentlyContinue)) {
$gitDir = "$env:LOCALAPPDATA\CustomGit"
if(Test-Path $gitDir) { Remove-Item -Path $gitDir -Recurse -Force }
New-Item -Path $gitDir -ItemType Directory
$gitLatestReleaseApi = (Invoke-WebRequest -UseBasicParsing | ConvertFrom-Json
$mingitObject = $gitLatestReleaseApi.assets `
| Where-Object {$ -match "MinGit-[\d.]*?"} `
| Select-Object browser_download_url
larshaendler /
Created Jan 22, 2019
Remove prefix from multiple files in Linux console


for file in prefix*; do mv "$file" "${file#prefix}"; done;

The for loop iterates over all files with the prefix. The do removes from all those files iterated over the prefix.

Here is an example to remove "bla_" form the following files:

WesJD /
Created Aug 3, 2016
Teleport players to random locations with efficiency from Guava
public class RandomTeleporter {
private final LoadingCache<Pair<Location, Location>, List<Pair<Integer, Integer>>> locationCache = CacheBuilder.newBuilder()
.expireAfterAccess(1, TimeUnit.MINUTES)
.build(new CacheLoader<Pair<Location, Location>, List<Pair<Integer, Integer>>>() {
public List<Pair<Integer, Integer>> load(Pair<Location, Location> bounds) throws Exception {
final List<Pair<Integer, Integer>> ret = new ArrayList<>();
final Location bounds1 = bounds.getLeft();
tylerneylon / .block
Last active Aug 6, 2022
Quick js code to draw math functions in an SVG element.
View .block
license: mit
DarkSeraphim /
Created Oct 13, 2015
Vector rotation utility
private static Vector rotateZ(Vector v, double rot)
return new Vector(v.getX() * Math.cos(rot) - v.getY() * Math.sin(rot),
v.getX() * Math.sin(rot) + v.getY() * Math.cos(rot),
private static Vector rotateY(Vector v, double rot)
return new Vector( v.getX() * Math.cos(rot) + v.getZ() * Math.sin(rot),
PurpleBooth /
Last active Jan 27, 2023
A template to make good

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.


riaqn /
Created Apr 3, 2015
a Gson adapter to convert ResultSet to Json(writer only)
import java.sql.*;
public class ResultSetAdapter extends TypeAdapter<ResultSet> {
public static class NotImplemented extends RuntimeException {}
private static final Gson gson = new Gson();
public ResultSet read(JsonReader reader)
throws IOException {
View flux.css
html {
filter: brightness(0.8) sepia(0.9);
-o-filter: brightness(0.8) sepia(0.9);
-ms-filter: brightness(0.8) sepia(0.9);
-moz-filter: brightness(0.8) sepia(0.9);
-webkit-filter: brightness(0.8) sepia(0.9);
-salesforce-filter: brightness(0.8) sepia(0.9);
-dropbox-filter: brightness(0.8) sepia(0.9);
-blink-filter: brightness(0.8) sepia(0.9);
scy /
Last active Jan 4, 2023
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

jboner / latency.txt
Last active Jan 27, 2023
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD