Skip to content

Instantly share code, notes, and snippets.

View chris-rock's full-sized avatar

Christoph Hartmann chris-rock

View GitHub Profile
@chris-rock
chris-rock / httpie.sh
Created August 3, 2014 14:39
Httpie Quick Install Ubuntu 14.04
apt-get update && apt-get install -y curl && curl --silent https://bootstrap.pypa.io/get-pip.py |python3 && pip install --upgrade httpie
@chris-rock
chris-rock / crypto-buffer.js
Last active January 28, 2025 02:50
Encrypt and decrypt buffers in nodejs
// Part of https://github.com/chris-rock/node-crypto-examples
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq';
function encrypt(buffer){
var cipher = crypto.createCipher(algorithm,password)
var crypted = Buffer.concat([cipher.update(buffer),cipher.final()]);
return crypted;
@chris-rock
chris-rock / crypto-ctr.js
Last active November 10, 2020 02:27
Encrypt and decrypt text in nodejs
// Part of https://github.com/chris-rock/node-crypto-examples
// Nodejs encryption with CTR
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq';
function encrypt(text){
var cipher = crypto.createCipher(algorithm,password)
var crypted = cipher.update(text,'utf8','hex')
@chris-rock
chris-rock / crypto-stream.js
Last active October 6, 2022 18:38
Encrypt and decrypt streams
// Part of https://github.com/chris-rock/node-crypto-examples
// Nodejs encryption of buffers
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq';
var fs = require('fs');
var zlib = require('zlib');
@chris-rock
chris-rock / crypto-gcm.js
Last active February 21, 2023 10:31
Use GCM for authenticated encryption in nodejs
// Nodejs encryption with GCM
// Does not work with nodejs v0.10.31
// Part of https://github.com/chris-rock/node-crypto-examples
var crypto = require('crypto'),
algorithm = 'aes-256-gcm',
password = '3zTvzr3p67VC61jmV54rIYu1545x4TlY',
// do not use a global iv for production,
// generate a new one for each encryption
iv = '60iP0h6vJoEa'
@chris-rock
chris-rock / gta_net.sh
Last active November 28, 2018 17:27
gta2 mac with network
# download gta from http://www.rockstargames.com/classics/
# download wine from http://winebottler.kronenberg.org/
# or install wine via brew install wine
# change export path if you are using brew install wine
export WINEPATH=/Applications/Wine.app/Contents/Resources
export PATH=$PATH:$WINEPATH/bin
# direplay support for network
brew install winetricks
for i in `gem list --no-versions`; do gem uninstall -aIx $i; done
@chris-rock
chris-rock / gist:d4e901a019b5d61f94c7
Created June 17, 2015 18:55
Watch file contents in directory
iwatch -c "find %f -type f -exec cat {} \;" ~/yourpath
@chris-rock
chris-rock / gist:515768448fc5ef906f3e
Created June 20, 2015 10:56
ruby invalid byte sequence in US-ASCII
# set ruby default encoding for debian-based systems
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
# Ubuntu
wget http://ftp.iitm.ac.in/ubuntu/pool/universe/s/s3cmd/s3cmd_1.5.2-2_all.deb
dpkg -i s3cmd_1.5.2-2_all.deb
# RHEL
yum install python-dateutil python-magic
wget ftp://mirror.switch.ch/pool/4/mirror/epel/6/i386/s3cmd-1.5.1.2-5.el6.noarch.rpm
rpm -i s3cmd-1.5.1.2-5.el6.noarch.rpm