Skip to content

Instantly share code, notes, and snippets.

@blinksmith
blinksmith / to-title-case.js
Created February 7, 2016 01:59
To Title Case for JavaScript
/*
* To Title Case 2.1 – http://individed.com/code/to-title-case/
* Copyright © 2008–2013 David Gouch. Licensed under the MIT License.
*/
/*
* modifications by @rvagg Apr-2014
*/
/*
@blinksmith
blinksmith / jscomp.js
Created February 28, 2016 17:57
jscomp
var $jscomp = {scope:{}, getGlobal:function(a) {
return "undefined" != typeof window && window === a ? a : "undefined" != typeof global ? global : a;
}};
$jscomp.global = $jscomp.getGlobal(this);
$jscomp.initSymbol = function() {
$jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol);
$jscomp.initSymbol = function() {
};
};
$jscomp.symbolCounter_ = 0;
##
# WHOIS servers for new TLDs (http://www.iana.org/domains/root/db)
# Current as of 2015-09-12
##
\.abbott$ whois.afilias-srs.net
\.abogado$ whois-dub.mm-registry.com
\.ac$ whois.nic.ac
\.academy$ whois.donuts.co
\.accountant$ whois.nic.accountant
@blinksmith
blinksmith / google-search.user.js
Last active February 3, 2017 19:41
google search url cleaner - userscript
// ==UserScript==
// @name google search url cleaner
// @author blinksmith
// @version 0.1
// @namespace https://gist.github.com/713fa531972fab77e5ad
// @description google search url cleaner
// @include https://encrypted.google.com/?*
// @include http://www.google.*/search?*
// @include https://www.google.*/search?*
// @grant none
package main
import (
"context"
"fmt"
"net"
"os/exec"
"strconv"
"strings"
"sync"
@blinksmith
blinksmith / cf-update-dns-txt.ps1
Created July 15, 2019 10:45 — forked from charlesroper/cf-update-dns-txt.ps1
PowerShell script to update the _acme-challenge TXT entry on CloudFlare
# See https://github.com/ebekker/ACMESharp/wiki/Quick-Start for background
# Could be enhanced by putting YOUR_CF_API_KEY and YOUR_EMAIL in environment vars
# Usage:
# > cf-update-dns-txt.ps1 -Domain example.com -Value vNx_fpLgvq0l4rqSATuxhxl9pa155SoeKvNZ98AFB_4
param( [string]$domain, [string]$value )
$headers = @{
"X-Auth-Key" = "YOUR_CF_API_KEY"
"X-Auth-Email" = "YOUR_EMAIL"
"Content-Type" = "application/json"
@blinksmith
blinksmith / apns-conf.xml
Created February 5, 2016 00:46
APNs List
<?xml version="1.0" encoding="utf-8"?>
<apns version="8" acer_version="2.109-2(p)">
<apn carrier="Vodafone Internet" mcc="276" mnc="02" apn="vodafoneweb" type="default"/>
<apn carrier="Vodafone Broadband" mcc="276" mnc="02" apn="vodafoneweb" type="default"/>
<apn carrier="Albanian Internet" mcc="276" mnc="01" apn="Internet" type="default"/>
<apn carrier="Albanian Broadband" mcc="276" mnc="01" apn="Internet" type="default"/>
<apn carrier="Djezzy Internet" mcc="603" mnc="02" apn="djezzy.internet" type="default"/>
<apn carrier="Djezzy Broadband" mcc="603" mnc="02" apn="djezzy.internet" type="default"/>
<apn carrier="Wataniya Internet" mcc="603" mnc="03" apn="Internet" user="nedjma" password="nedjma" type="default"/>
<apn carrier="Wataniya Broadband" mcc="603" mnc="03" apn="Internet" user="nedjma" password="nedjma" type="default"/>
# Show message box popup.
Add-Type -AssemblyName System.Windows.Forms
$result = [System.Windows.Forms.MessageBox]::Show("My message", "Window Title", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::None)
# Show input box popup.
Add-Type -AssemblyName Microsoft.VisualBasic
$inputText = [Microsoft.VisualBasic.Interaction]::InputBox("Enter some value:", "Window Title", "Default value")
# Show an Open File Dialog and return the file selected by the user.
function Read-OpenFileDialog([string]$InitialDirectory, [switch]$AllowMultiSelect)
@blinksmith
blinksmith / go-min-server1.go
Last active March 30, 2024 16:58
Collection of Minimal Go web server
package main
import (
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir(".")))
http.ListenAndServe(":8080", nil)
}
@blinksmith
blinksmith / X509KeyPairtest.go
Created February 26, 2016 20:50
Golang crypto/tls.X509KeyPair function usage example
package main
import (
"fmt"
"os"
"crypto/tls"
"crypto/x509"
)
func main() {
var rsaCertPEM = [] byte(`-----BEGIN CERTIFICATE-----
MIICEzCCAXygAwIBAgIQMIMChMLGrR+QvmQvpwAU6zANBgkqhkiG9w0BAQsFADAS