Skip to content

Instantly share code, notes, and snippets.

View toqueteos's full-sized avatar
🤠
Deleting code

Carlos Cobo toqueteos

🤠
Deleting code
View GitHub Profile
@jonsterling
jonsterling / gist:1117345
Created July 31, 2011 23:30
Feeds I like
@nsf
nsf / clean.bash
Last active March 4, 2019 14:38
Perlin noise benchmark
#!/bin/bash
rm -rf *.o *.[568] test_*
@bemasher
bemasher / stack.go
Last active August 19, 2020 10:59
A simple LIFO stack backed by a linked list implemented with golang.
package main
import (
"fmt"
)
type Stack struct {
top *Element
size int
}
@aras-p
aras-p / preprocessor_fun.h
Last active July 16, 2024 02:50
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@CodeMonkeyKevin
CodeMonkeyKevin / gist:6407086
Created September 1, 2013 20:26
GoLang UUID pkgs benchmark
// github.com/nu7hatch/gouuid
BenchmarkV4 1000000 1426 ns/op
BenchmarkV5 2000000 910 ns/op
// github.com/streadway/simpleuuid
BenchmarkV5 5000000 689 ns/op
// github.com/tux21b/gocql/tree/master/uuid
BenchmarkRandomUUID 1000000 1470 ns/op
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active July 18, 2024 07:57
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

@Sithdown
Sithdown / gist:7400369
Created November 10, 2013 16:33
Pseudocode sugerence for @toqueteos UnityForts
Clase Weapons(String configfile="weapons.cfg"):
init(configfile):
self.weapons = []
if(configfile):
#leemos todos los weapons de un archivo que contiene cada weapon en una linea, con nombre, daño, bla bla
for i in readlines(configfile):
self.weapons.push(new Weapon(i))
ofclass(name):
@benui-dev
benui-dev / ErrorReporter.cs
Created May 12, 2014 15:18
Hacky error reporter for Unity. Takes a screenshot and uploads it with system information to your server. Almost certainly super insecure.
using UnityEngine;
using System.Collections;
using System.Text;
public class ErrorReporter
{
static string m_postUrl = "http://www.yoursite.com/reports/report.cgi";
static string m_reportUrl = "http://www.yoursite.com/reports/";
// Take screenshot
@hjwp
hjwp / Dockerfile
Created August 1, 2014 11:53
Building a postgres docker image...
FROM ubuntu:trusty
MAINTAINER developers@pythonanywhere.com
# Add the PostgreSQL PGP key to verify their Debian packages.
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
# Add PostgreSQL's repository. It contains the most recent stable release
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main 9.4" > /etc/apt/sources.list.d/pgdg.list
@jpillora
jpillora / sshd.go
Last active December 17, 2023 16:27
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client: