Skip to content

Instantly share code, notes, and snippets.

@pandrewhk
pandrewhk / FreeBSD 13.2 arm64 on Hetzner CAX11 Installation
Last active September 26, 2023 17:46
FreeBSD 13.2 arm64 on Hetzner CAX11
- # download VIMAGE to a spare FreeBSD box
- unxz -T0 # uncompress
- mdconfig image.raw; mount # for editing
- sshd_enable
- devmatch_blacklist="virtio_random.ko" # avoid a bug
- PermitRootLogin
- /root/.ssh/authorized_keys
- umount; mdconfig -d
- xz -T0 -9 # compress edited image
- cp nginx/ # publish with any web server
@oskar456
oskar456 / pref64.diff
Created July 5, 2022 11:42
A quick and dirty patch to add Pref64 RA option to odhcpd (RFC 8781)
diff --git a/src/router.c b/src/router.c
index 541c023..9ad79d4 100644
--- a/src/router.c
+++ b/src/router.c
@@ -390,6 +390,7 @@ enum {
IOV_RA_ROUTES,
IOV_RA_DNS,
IOV_RA_SEARCH,
+ IOV_RA_PREF64,
IOV_RA_ADV_INTERVAL,
@a14m
a14m / facebook.rb
Last active February 24, 2022 18:08
Gist for manually OAuth2 facebook for Rails APIs
# lib/omniauth/facebook.rb
require 'httparty'
module Omniauth
class Facebook
include HTTParty
# The base uri for facebook graph API
base_uri 'https://graph.facebook.com/v2.3'
@ufologist
ufologist / CryptoJS-DES.html
Created May 15, 2013 03:34
Use CryptoJS encrypt message by DES and direct decrypt ciphertext, compatible with Java Cipher.getInstance("DES")
<!-- test pass with CryptoJS v3.1.2 -->
<script src="rollups/tripledes.js"></script>
<script src="components/mode-ecb.js"></script>
<script>
/**
* Encrypt message by DES in ECB mode and Pkcs7 padding scheme
*
* NOTE: DES is weak, please use 3DES(Triple DES) or AES
*
* @param {String} message
@ishaq
ishaq / KUtils.h
Last active October 11, 2019 22:15 — forked from jpwatts/xcode-git-version.sh
This Xcode build phase script automatically sets the version and short version string of an application bundle based on information from the containing Git repository. To Use it, you 1) add the contents of `xcode-git-version.sh` to a "Run Script" build phase for your application target. 2) add a new value to your info plist called `FullVersion` …
#import <Foundation/Foundation.h>
@interface KUtils : NSObject
+ (NSString *)getVersionInfo;
@end
@benedikt
benedikt / rails.rb
Created July 30, 2011 13:16
Capistrano task to open a rails console on a remote server. Require this file in your deploy.rb and run "cap rails:console"
# encoding: UTF-8
Capistrano::Configuration.instance(:must_exist).load do
namespace :rails do
desc "Open the rails console on one of the remote servers"
task :console, :roles => :app do
hostname = find_servers_for_task(current_task).first
exec "ssh -l #{user} #{hostname} -t 'source ~/.profile && #{current_path}/script/rails c #{rails_env}'"
end
end
@jpwatts
jpwatts / xcode-git-version.sh
Created May 11, 2011 16:42
This Xcode 4 build phase script automatically sets the version and short version string of an application bundle based on information from the containing Git repository.
#!/bin/bash
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode 4, add the contents to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset