Skip to content

Instantly share code, notes, and snippets.

@atoponce
atoponce / gist:07d8d4c833873be2f68c34f9afc5a78a
Last active April 8, 2025 14:06 — forked from tqbf/gist:be58d2d39690c3b366ad
Cryptographic Best Practices

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

anonymous
anonymous / main.dart
Created August 17, 2015 20:07
fragrant-snow-1285
//import 'dart:io';
/// We'll strip question mark, comma, period, double quote before comparison.
/// Apostrophe is OK.
RegExp punctuation = new RegExp('\\?|"|\\.|,');
main(List<String> args) {
// Dart's [Iterable] is lazy by default; [List] is the result of iteration.
//var lines = new File('words.txt').readAsLinesSync().where(_nonempty);
@dylanmcdiarmid
dylanmcdiarmid / sexp-cheat-sheet
Created February 9, 2015 16:18
vim sexp mappings for normal people cheat sheet
.vimrc
" Map leader to comma
let maplocalleader=","
" Toggle this for vim-sexp to not go into insert mode after wrapping something
let g:sexp_insert_after_wrap = 0
" Toggle this to disable automatically creating closing brackets and quotes
let g:sexp_enable_insert_mode_mappings = 1
Vocab
@Otacon22
Otacon22 / gist:1a43c785226a06a72872
Created January 29, 2015 13:31
Plugin to ignore voice/devoice messages on Hexchat (useful with Slack.com IRC backend)
import hexchat
__module_name__ = "novoice"
__module_version__ = "2.0"
__module_description__ = "Ignores voice messages from ChanServ"
def voice_event(word, word_eol, userdata):
return hexchat.EAT_HEXCHAT
hexchat.hook_print("Channel Voice", voice_event)
@olivierlacan
olivierlacan / changelog_parser.rb
Last active August 29, 2015 14:14
Really naive CHANGELOG parser we used on Code School for a while to export public-facing release notes from a private-ish CHANGELOG.md file.
require 'vandamme'
module PagesHelper
def changes
changes = {}
sections = changelog_file.each_with_index do |day, index|
change_sets = {}
day[1].scan(section_title_scanner) do |match|
@stevenroose
stevenroose / enable_ssl.dart
Last active June 4, 2021 06:25
Setup CA-enabled SSL for Dart
void enableSSL() {
// the password used for the certutil db
var sslPassword = "";
// the certificate subject
// retrieved from certutil with command
// > certutil -d sql:. -L -n my_domain
// and look for the "Subject: " line under certificate data
var certificateName = "CN=mydomain.com,OU=...";
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@kachayev
kachayev / concurrency-in-go.md
Last active January 6, 2025 22:43
Channels Are Not Enough or Why Pipelining Is Not That Easy
@sethladd
sethladd / simple_serialization_tests.dart
Created August 5, 2014 21:07
Looking at both a simple by-hand JSON serialization, and an "automatic" serialization via mirrors. Note: this is by design extremely limited and only for illustration in a mailing list thread. Your need are almost certainly different and will need something custom.
import 'dart:convert';
import 'package:smoke/smoke.dart' as smoke;
@MirrorsUsed(targets: const [SimpleWithMirrors, Simple], override: '*')
import 'dart:mirrors';
class Simple {
int id;
String name;
@staltz
staltz / introrx.md
Last active April 24, 2025 06:10
The introduction to Reactive Programming you've been missing