Skip to content

Instantly share code, notes, and snippets.

View pacharanero's full-sized avatar
💭
messing with a Discourse forum, somewhere

Marcus Baw pacharanero

💭
messing with a Discourse forum, somewhere
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/sh
ADAPTER="Adapter1"
ADDRESS="hci0"
IS_BLUETOOTH_ON=$(dbus-send --system --dest=org.bluez --print-reply /org/bluez/${ADDRESS} org.freedesktop.DBus.Properties.Get string:org.bluez.${ADAPTER} string:Powered )
DESIRED_STATE="false"
case $IS_BLUETOOTH_ON in
*false*)
@pacharanero
pacharanero / openehr-EL-as-ruby.rb
Last active September 26, 2018 08:58
An illustration of how OpenEHR Expression Language woud look as Ruby
# real ruby libraries you can use to save having to develop them anew
require 'iso-639'
# fictional ruby libraries that would add the missing datatypes
require 'icd10' # a library which handles ICD-10 bindings
require 'snomed-ct' # a library which handles SNOMED-CT bindings
require 'adl-binding' # a library which lets us handle ADL as a ruby object
require 'terminology' # some arbitrary terminology helper library
# openEHR-ELOM.breast_cancer_treatment.v1
@lokhman
lokhman / ubuntu-hardening.md
Last active April 23, 2024 09:05
List of things for hardening Ubuntu

WARNING

May contain out of date information. Check the comments below!

The list of actions listed below was taken mostly from Book Of Zeus with minor modifications and did the job well for Ubuntu version, which was available at that moment (May 2016). This gist was created for internal use and was never meant to be discovered by the web, although Google managed to find and index this page, which was a great surprise for me. Please check the original source for the updated information (links are provided in most of the sections), and read the comments below: they provide more details about the usage experience.

System Updates

http://bookofzeus.com/harden-ubuntu/initial-setup/system-updates/

Keeping the system updated is vital before starting anything on your system. This will prevent people to use known vulnerabilities to enter in your system.

@joepie91
joepie91 / vpn.md
Last active May 20, 2024 03:37
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@GeoffreyPlitt
GeoffreyPlitt / convert_url_files_to_bookmarks.sh
Created December 29, 2014 00:53
Convert a folder of .URL files to a bookmarks.html file that can be imported into a browser
#!/bin/bash
#
# Run this script in a folder full of ".url" files, and pipe output to an HTML file.
# Example: ./convert_url_files_to_bookmarks.sh > bookmarks.html
echo "<!DOCTYPE NETSCAPE-Bookmark-file-1>"
echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">'
echo '<TITLE>Bookmarks</TITLE>'
echo '<H1>Bookmarks</H1>'
echo '<DL><p>'
@jorgemanrubia
jorgemanrubia / discourse_users_merger.rb
Last active April 18, 2022 12:53
Script for merging existing discourse users
module DiscourseUsersMerger
class Merger
def merge(target_username, source_username)
raise "User to merge and target user can't be the same" if target_username == source_username
target_user = User.find_by_username!(target_username)
source_user = User.find_by_username!(source_username)
puts "About to merge #{source_username} (#{source_user.email}) into #{target_username} (#{target_user.email})"
puts "#{source_user.topics.count} topics with #{source_user.posts.count} posts will be moved. Ok to continue? (y/n)"
continue = STDIN.gets.chomp.downcase == 'y'
@brito
brito / API design
Created March 21, 2013 07:30
Joshua Bloch: Bumper-Sticker API Design
All programmers are API designers:
Good programs are modular, and intermodular boundaries define APIs. Good modules get reused.
APIs can be among your greatest assets or liabilities:
Good APIs create long-term customers; bad ones create long-term support nightmares.
Public APIs, like diamonds, are forever:
You have one chance to get it right so give it your best.
APIs should be easy to use and hard to misuse: