Skip to content

Instantly share code, notes, and snippets.

View kaspergrubbe's full-sized avatar

Kasper Grubbe kaspergrubbe

View GitHub Profile
<?php
ob_start();
var_dump($_POST);
$output = ob_get_clean();
$outputFile = "var_dump_output.txt";
$filehandle = fopen($outputFile, 'a') or die("File creation error."");
fwrite($fileHandle, $output);
fclose($fileHandle);
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | gdisk /dev/sda
n # new partition
1 # partition number 1
2048 # first sector
4095 # end sector
ef02 # BIOS boot partition
n # new partition
2 # partition number 2
4096 # first sector
1028095 # end sector
def request(linode_method, query_args = {})
begin
args = {
api_key: @api_key,
api_action: linode_method,
}.merge(query_args).map{|k,v| "#{k}=#{v}"}.compact.join('&')
uri = URI("https://api.linode.com/?#{args}")
http = Net::HTTP.new(uri.host, uri.port)
def deep_munge(hash)
hash.each do |k, v|
case v
when Array
v.grep(Hash) { |x| deep_munge(x) }
v.compact!
hash[k] = nil if v.empty?
when Hash
deep_munge(v)
end
class PasswordChange
include ActiveModel::Model
attr_accessor(
:user,
:current_password,
:new_password,
:new_password_confirmation,
)
$(document).ready(function(){
$(".zoomable").click (function() {
if($(this).height() == 480){
$(this).animate({
height: '980',
width: '980'
});
}else{
$(this).animate({
height: '480px',
set -eux
set -o pipefail
# ! #<Blocks::Base::Builder:0x007f8b2d2f3ef0> -------------------------------------
if [ ! -f /root/system_setup_complete ]; then
apt-get update
apt-get -y install aptitude
aptitude -y full-upgrade
fi
echo "wilmut.example.com" > /etc/hostname
hostname -F /etc/hostname
#!/usr/bin/env ruby
require 'fileutils'
require 'json'
DIRECTORY_NAME = '/Users/kaspergrubbe/Pictures/screenie/'
API_KEY = ''
URL = 'https://cdn.servnice.com/screenie'
unless File.directory?(DIRECTORY_NAME)
def test
puts "Hello"
end
=> nil
Object.test
=> NoMethodError: private method 'test' called for Object:Class
Object.send(:test)
Hello
<script>
var _adftrack = {
pm: 357733,
divider: encodeURIComponent('|'),
pagename: encodeURIComponent('Billetto 76303')
};
(function () { var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = 'https://track.adform.net/serving/scripts/trackpoint/async/'; var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); })();
</script>