Skip to content

Instantly share code, notes, and snippets.

@sma
sma / markdown_to_bbcode.py
Created December 23, 2011 11:26
Converts a subset of markdown into BBcode
import re
def markdown_to_bbcode(s):
links = {}
codes = []
def gather_link(m):
links[m.group(1)]=m.group(2); return ""
def replace_link(m):
return "[url=%s]%s[/url]" % (links[m.group(2) or m.group(1)], m.group(1))
def gather_code(m):
@akost
akost / convert.sh
Created April 4, 2012 19:06
Bash script for recursive file convertion windows-1251 --> utf-8
#!/bin/bash
# Recursive file convertion windows-1251 --> utf-8
# Place this file in the root of your site, add execute permission and run
# Converts *.php, *.html, *.css, *.js files.
# To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command
find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f |
while read file
do
@jrus
jrus / lua-uuid.lua
Created July 29, 2012 09:26
quick lua implementation of "random" UUID
local random = math.random
local function uuid()
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function (c)
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
return string.format('%x', v)
end)
end
@sytkov
sytkov / smb.conf
Created November 9, 2012 12:22
/etc/samba/smb.conf
semanage fcontext -a -t samba_share_t /root/downloads
chcon -R -t samba_share_t /root/downloads
@psyrendust
psyrendust / org.samba.nmbd.plist
Last active October 18, 2020 13:22
LaunchDaemons for fixing Samba for OS X Mavericks.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.samba.nmbd</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
@touilleMan
touilleMan / multiReplace.lua
Last active January 9, 2020 11:45
Aegisub script to do multiple replacements a once on the sub
--[[
multiReplace is (c) 2015 by Emmanuel Leblond <[email protected]>.
It is licensed to you under the terms of the WTFPLv2 (see below).
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
@rickowski
rickowski / randomfilerenamer.py
Last active December 16, 2022 14:09
Python script to rename every file in a given folder to a random name, including the original file extension.
#!/usr/bin/python3
# Copyright © 2015 Ole Rickowski
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
import os,sys,random,string
# Print help
@AndrewHazelden
AndrewHazelden / FusionFileSelection.lua
Created February 11, 2016 12:05
A Blackmagic Design Fusion LUA script example to check the current comp's flow area for the currently selected Loader/Saver nodes.
-- Find out if we are running Fusion 6, 7, or 8
local fu_major_version = math.floor(tonumber(eyeon._VERSION))
-- Find out the current operating system platform. The platform local variable should be set to either "Windows", "Mac", or "Linux".
local platform = ""
if string.find(fusion:MapPath("Fusion:\\"), "Program Files", 1) then
-- Check if the OS is Windows by searching for the Program Files folder
platform = "Windows"
elseif string.find(fusion:MapPath("Fusion:\\"), "PROGRA~1", 1) then
@ulve
ulve / du.ps1
Last active July 17, 2023 06:28
du-h in powershell
param([string]$Directory)
get-childitem $Directory |
% { $f = $_ ;
get-childitem -r $_.FullName |
measure-object -property length -sum |
select @{Name="Namn";Expression={$f}},@{Name="Sum (Mb)"; Expression={"{0:N1}" -f ($_.sum / 1MB)}}}
@arturogutierrez
arturogutierrez / mongodb_ssl_with_letsencrypt.md
Created March 28, 2016 14:37 — forked from leommoore/mongodb_ssl_with_letsencrypt.md
MongoDB 3.2.x SSL with Letsencrypt

#MongoDB 3.2.x SSL with Letsencrypt Letsencrypt is an initative which aims to increase the use of encryption for websites. It basically allows people to apply for free certificates provided that they prove the they control the requested domain. We will look at the what is needed to secure your MongoDB installation. For more details on setting up a MongoDB server see MongoDB 3.2.x.

##Set the hostname We sould to set the hostname to match the name of the certificate we are going to optain.

sudo hostname mongo0.example.com

Then update the hostname file to set the server name permanently.