Skip to content

Instantly share code, notes, and snippets.

View icholy's full-sized avatar
💥
breaking things

Ilia Choly icholy

💥
breaking things
View GitHub Profile
// Talking console
//
// Support: http://caniuse.com/#search=SpeechSynthesisUtterance
//
// Copy paste the code into dev console or
// use http://mrcoles.com/bookmarklet/ to create a bookmarklet.
/* ✂️ ......................................................................................... */
if(console.log.name !== 'talkLog') {
console.l = console.log;
@vodolaz095
vodolaz095 / NumberOfTheWeekInMonth.go
Created February 19, 2016 15:33
Get the number of the week in Golang
package main
import(
"fmt"
"time"
)
func NumberOfTheWeekInMonth(now time.Time) int {
beginningOfTheMonth := time.Date(now.Year(), now.Month(), 1, 1, 1, 1, 1, time.UTC)
_, thisWeek := now.ISOWeek()
@jackspirou
jackspirou / rewriteImportPaths.go
Last active December 21, 2022 17:48
A method for rewriting golang import paths.
package importpaths
import (
"log"
"os"
"strconv"
"strings"
"go/ast"
"go/parser"
@sivel
sivel / better-ssh-authorized-keys-management.md
Last active April 8, 2024 07:53
Better SSH Authorized Keys Management

Better SSH Authorized Keys Management

A seemingly common problem that people encounter is how to handle all of your users authorized_keys file.

People struggle over management, ensuring that users only have specific keys in the authorized_keys file or even a method for expiring keys. A centralized key management system could help provide all of this functionality with a little scripting.

One piece of functionality overlooked in OpenSSH is the AuthorizedKeysCommand configuration keyword. This configuration allows you to specify a command that will run during login to retrieve a users public key file from a remote source and perform validation just as if the authorized_keys file was local.

Here is an example directory structure for a set of users with SSH public keys that can be shared out via a web server:

@archgrove
archgrove / gist:6766129
Created September 30, 2013 16:09
Replays a git history, passing the repository at each state to a given script
#!/bin/bash
# Takes a repository and script from the command line
# and executes the script for each git log entry in reverse chronological order
# Use temporary files of the following format
TMP_TEMPLATE="/tmp/gitreplay-XXXXXXXX"
# Validate command line parameters
if [ -z $1 -o -z $2 ]; then
@nexneo
nexneo / gobreak.sh
Last active December 16, 2015 19:19 — forked from icholy/gobreak.sh
#!/bin/sh
# Demo http://ascii.io/a/3019
# build with debug flags
go build -gcflags "-N -l" -o out
# find the debugger comments
awk '/\/\/debugger/ { print "break " FILENAME ":" FNR; }' `find $PWD -name "*.go" | xargs` > .breakpoints
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@paulmillr
paulmillr / dart.md
Last active July 15, 2023 13:36
Leaked internal google dart email

---------- Forwarded message ----------

From: Mark S. Miller <erights@google.com>
Date: Tue, Nov 16, 2010 at 3:44 PM
Subject: "Future of Javascript" doc from our internal "JavaScript Summit"
last week
To: javascript-standard@google.com
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt