Skip to content

Instantly share code, notes, and snippets.

Avatar
✍️
Working from home on open source

Daniel P. Clark danielpclark

✍️
Working from home on open source
View GitHub Profile
View Transfer files with RSync and SSH from remote server to local machine.md

All of the following commands are to be run on the remote machine where the files to copy are

We need a key to connect with SSH

ssh-keygen -t rsa -b 4096

Put that pub key in the destination machine's ~/.ssh/authorized_keys

(asuming destination SSH is up and configured for accepting keys)

cat ~/.ssh/id_rsa.pub

View git-workflow.md

Merging a PR in to develop

Using a branch named EXAMPLE_BRANCH:

git checkout develop
git fetch --all
git rebase origin/develop
git checkout EXAMPLE_BRANCH
git rebase develop
View Webpacker config Rails 6 VueJS vue-loader 15.md

At the moment upgrading vue-loader causes some changes in how things are done. These are my config options for these items just to get it working.

config/webpack/environment.js

const { environment } = require('@rails/webpacker')
const coffee = require('./loaders/coffee')
const vue = require('./loaders/vue')

environment.loaders.append('vue', vue)
View Favorite Ruby Gems.md

Favorite Ruby Gems

Gem Description
annotate_models writes the model schema to the model tests and app model files as comments.
arbre an Object Oriented DOM Tree in Ruby
arel a relational algebra
benchmark-ips provides iteration per second benchmarking for Ruby
byebug Rails' default debug tool of choice
churn the history of churns to give the number of times a file, class, or method is changing during the life of a project
coveralls online service for code coverage
View dind
The following configuration doesn't work.
docker run -d --name gitlab-dind --privileged --restart always --network gitlab-runner-net -v /var/lib/docker -v /etc/gitlab-runner:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock docker:18.06.1-ce-dind --storage-driver=overlay2
docker run -d --name gitlab-runner --restart always --network gitlab-runner-net -v /etc/gitlab-runner:/etc/gitlab-runner -e DOCKER_HOST=tcp://gitlab-dind:2375 gitlab/gitlab-runner:alpine
docker run -it --rm -v /etc/gitlab-runner:/etc/gitlab-runner gitlab/gitlab-runner:alpine register --executor docker --docker-image docker:18.06.1-ce --docker-volumes /var/run/docker.sock:/var/run/docker.sock
View gotham.deps
apt-get update
apt-get install ruby nodejs curl build-essential ruby-dev libxml2-dev
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get update && apt-get install yarn
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
export USER=root
gem install bundler rake webpacker_cli
View Gitlab.md
# After 1 Day
ObjectSpace.count_objects
{:TOTAL=>2525490,
 :FREE=>632388,
 :T_OBJECT=>100864,
 :T_CLASS=>27995,
 :T_MODULE=>5032,
 :T_FLOAT=>11,
 :T_STRING=>785488,
View Ruby_C_ext_notes_JA_conf_RubyKaigi.md

Mark

Tell Garbage Collector which objects you use. Ruby takes care of object lifecycle; C doesn't. If you still need objects, mark them in use.

void mark(void* p) {
 auto* hash = reinterpret_cast(p);
@danielpclark
danielpclark / aes_example.rs
Created May 11, 2018
Started writing AES file parser. Doing a rewrite with `nom` so this is for reference.
View aes_example.rs
extern crate byteorder;
use byteorder::{BigEndian,ByteOrder};
use std::io::prelude::*;
use std::fs::File;
use std::str;
// 3 Octets - 'AES'
// 1 Octet - 0x02 (Version)
// 1 Octet - Reserved (set to 0x00)
// .... Start of repeating extension block section
View flicker.html
<html>
<body>
<style>
.ebb-bottom {
background-image: url(https://6ftdan.com/wp-content/uploads/2018/04/ebbnflow.png);
background-size: 400px 400px;
}
.images > div {
float: left;
width: 400px;