Skip to content

Instantly share code, notes, and snippets.

@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active March 13, 2025 09:13
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
anonymous
anonymous / template.py
Created November 19, 2013 19:30
Template for cooperative strategy in robotgames
class Game:
def __init__(self, data, player_id):
self.player_id = player_id
self.update(data)
def update(self, data):
self.turn = data['turn']
self.robots = data['robots']
self.onNewTurn()
pass
@nickfloyd
nickfloyd / windbg_memory.txt
Last active January 20, 2025 09:57
windbg commands for finding memory leaks
From:
http://blogs.msdn.com/b/paullou/archive/2011/06/28/debugging-managed-code-memory-leak-with-memory-dump-using-windbg.aspx
#Set symbols File >> Symbol File path
SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
.reload
.loadby sos clr or .loadby sos mscorwks!
@lopezjurip
lopezjurip / README.md
Last active April 5, 2017 08:23
Ionic2 publish Android app | sign .apk step

Go to the output .apk directory:

cd /Users/patriciolopez/Repositories/almapp/uc-courses-mobile/platforms/android/build/outputs/apk/

Put your release.keystore in that folder, if you don't have one (change ALIAS):

keytool -genkey -v -keystore release.keystore -alias ALIAS -keyalg RSA -keysize 2048 -validity 10000
@andrewrk
andrewrk / 3let.py
Created February 15, 2016 03:27
origin of the zig programming language name. https://github.com/andrewrk/zig/
import string
import random
vowels = "aoeuiy"
def m():
c1 = vowels[random.randint(0,len(vowels)-1)]
c2 = string.ascii_lowercase[random.randint(0,len(string.ascii_lowercase)-1)]
c3 = string.ascii_lowercase[random.randint(0,len(string.ascii_lowercase)-1)]
print('z' + c1 + c2 + c3)
m()
Start GDB and execute the following commands:
catch syscall ptrace
commands 1
set ($eax) = 0
continue
end
Then, run the app and voilá! you can debug your program :)
@Tetralux
Tetralux / odin.bat
Last active June 11, 2023 15:56
A helper for compiling code with Odin on Windows
@ECHO OFF
:: Path to Odin executable
SET ODINPATH="C:\odin\odin.exe"
:: Path to the Microsoft 'vcvarsall.bat' file.
:: This sets the required environment vars and makes cl.exe and link.exe available in PATH.
SET VCVARSPATH="C:\Program Files (x86)\Microsoft Visual Studio\VC\Auxiliary\Build\vcvarsall.bat"
:: Only run the MSVC batch file the first time we
@vassvik
vassvik / gist:0a08ce59b678a77579db9392df983306
Last active September 25, 2017 08:14
Odin vector types and bulk operations
// Vectors are similar to arrays, but they are allow for bulk operations to all of its elements.
// Thet are meant to map to hardware level vector instructions but they can be any arbitrary length.
// Vector types only allow numeric and logical types (integers, floats, complex numbers, booleans).
// A vector type is composed as: `[vector size]T`.
// Almost all operators that work on the base type also work on the vector type.
// Exceptions are comparisons for bool vectors, shifts are for integer vectors.
fmt.println("complex operations");
c1 := [vector 2]complex64{1.0 + 3.14i, 3.0 - 5.0i};
@vassvik
vassvik / file.go
Last active December 5, 2024 15:35
Odin polymoprhic procedures and parametric types
// Odin has support for explicit and implicit polymorphic procedures and parametric types
// An explicit polymorphic procedure has the type passed as a parameter,
// while an implicit polymorphic procedure infers the type from the arguments
// a typical use-case for an explicit polymorphic procedure can be found in core/_preload.odin:
new :: proc(T: type) -> ^T {
ptr := cast(^T)alloc(size_of(T), align_of(T));
ptr^ = T{};
return ptr;
}