Skip to content

Instantly share code, notes, and snippets.

Avatar

Henrik 242 Jensen henrikj242

View GitHub Profile
View bashrc
# cd to a some default direcory
# cd /c/code/
# load ssh agent so to not keep having to enter keyfile password
eval $(ssh-agent -s)
ssh-add
# Was only used on a particular project
# export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
# export PATH=$PATH:/c/Users/henrik/.vagrant.d
View org-text-shellcard-pluskort.html
<div class="heading-text" >
Medlemmer af en fagforening tilknyttet PlusKort får fast rabat på 17 øre pr. liter benzin og 22 øre pr. liter diesel.
Rabatterne gives altid på standerens pris og på alle Shell stationer i Danmark. Shell Card gennem PlusKort er uden
gebyr til Betalingsservice. Har du allerede et Shell Card og ønsker at få PlusKorts rabat på dit kort, skal du kontakte
Shell Card Kundeservice på 99 33 33 60 på hverdage kl. 8-17.
</div>
View parse-html-list.rb
require 'nokogiri'
unordered_list = <<~END
<ul>
<li>
First item
</li>
<li>
Second item
<ul>
@henrikj242
henrikj242 / client_databases_from_bash.sh
Last active Dec 21, 2018
peytz_mail connecting with many things
View client_databases_from_bash.sh
# Use mongo console command `show databases` to get the databases and their size:
dbs=$(mongo --quiet <<EOF
show dbs
quit()
EOF
)
i=0
j=0
client_dbs=()
for db in ${dbs[*]}
@henrikj242
henrikj242 / array_of.rb
Created Sep 6, 2018
Rspec custom matcher example
View array_of.rb
# Save this file in spec/support/matchers
RSpec::Matchers.define :be_an_array_of do |expected|
match do |actual|
actual.is_a?(Array) && actual.map(&:class) == expected
end
end
# usage:
# expect([Subscriber.new(email: 'test@example.com'), []]).to be_an_array_of([Subscriber, Array])
@henrikj242
henrikj242 / createAttachment.cs
Last active Nov 29, 2018
PeytzMail Api Examples
View createAttachment.cs
using System;
using System.IO;
using System.Net;
namespace pmAttachment
{
class Program
{
static void Main(string[] args)
{
View another-csv-reformat.rb
## -------------------------------------------------------------------------------------
# This script parses a csv file, groups customers (whom may occur more than once), based on their email.
# It attempts to include the most meaningful stem data (first name, last name etc) for each customer
# - This means taking the last value after sorting so to not use empty values, but it the same customer
# exists more than once with actual values in his stem data, it may become invalid.
# It generates a row for each customer, with their purchases listed in the same way as the input file:
# - All skus in one column, separated by a comma,
# - All order dates in one column, separated by a comma
# ... etc
# Certain columns (7-13) are skipped
View ksp-mill-range-to-db.ksp
{
This code is for the Native Instruments Kontakt sampler v4 or above.
It may assist in converting between the ksp-specific range (0 - 1_000_000) and decibel (as used to set the volume for groups).
I've also published a list of some values between 100_000 and 1_000_000 in steps of 10_000:
https://docs.google.com/spreadsheets/d/1JmXV9E0mrHkd7ZTm2n1LCRxZPhiueFGVP4dtLR6U04Y
}
on init
declare ui_knob $Volume (100000, 1000000, 1)
set_knob_unit ($Volume,$KNOB_UNIT_DB)
View copy_rename.rb
#!/usr/bin/ruby
# We use this script to rename samples. The samples come from Logic, and have then been batch-processed (but not renamed)
# This script renames samples in a specified directory like so:
# - Give them all a three digit numeric suffix.
# - If it's a BD or SD +OSC2 sample, assume it's "colored" and name it accordingly.
# - In all other cases, assume not "colored", and just name it with A (round-robin, not accent) or B (round-robin, accent).
#
# Note that while the dry run does not make any changes, it may not reveal potential issues when running the script for real.
View PeytzMailFetchUnsubscribes.cs
using System;
using System.IO;
using System.Net;
using static System.Console;
public static class Program
{
static void Main()
{
WebClient client = new WebClient ();