This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person : RealmObject | |
{ | |
public string Name { get; set; } | |
public Person(string name) | |
{ | |
ValidateName(name); | |
Name = name; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var recursiveAtt = typeof(MyClass).GetCustomAttributes(inherit: true).Single() as RecursiveAttribute; | |
Console.WriteLine($"MyClass attribute value: {recursiveAtt.SomeValue}"); | |
var recursiveAttConstructorAtt = recursiveAtt.GetType().GetConstructor(new Type[0]).GetCustomAttributes(inherit: true).Single() as RecursiveAttribute; | |
Console.WriteLine($"MyClass attribute's ctor's attribute value: {recursiveAttConstructorAtt.SomeValue}"); | |
// Prints: | |
// MyClass attribute value: cde |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
namespace ListVSHashSet | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
class Solution | |
{ | |
static void ReduceString(StringBuilder sb) | |
{ | |
if (sb.Length > 1) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make sure to npm install node-google-translate-skidz | |
// More info: https://realm.io/docs/realm-object-server/#calling-node-modules-from-realm-functions | |
let translate = require('node-google-translate-skidz'); | |
module.exports = function(changeEvent) { | |
let realm = changeEvent.realm; | |
for (let className in changeEvent.changes) { | |
if (className !== 'TranslateRequest') { | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo crontab -e | |
# choose your favourite editor and paste this at the bottom of the file | |
0 4 * * * certbot renew --renew-hook /etc/realm/keys/post-renew.sh --quiet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo certbot renew --renew-hook /etc/realm/keys/post-renew.sh --force-renewal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
for domain in $RENEWED_DOMAINS; do | |
case $domain in | |
ros.myserver.com) # <- Update this with your own server | |
realm_cert_root=/etc/realm/keys | |
# Make sure the certificate and private key files are |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo mkdir /etc/realm/keys | |
sudo chown realm:realm /etc/realm/keys | |
sudo chmod 500 /etc/realm/keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install certbot | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:certbot/certbot | |
sudo apt-get update | |
sudo apt-get install certbot | |
# fire it up in certonly mode | |
sudo certbot certonly |