Skip to content

Instantly share code, notes, and snippets.

View aniketpant's full-sized avatar
WHAT

Aniket Pant aniketpant

WHAT
View GitHub Profile
@aniketpant
aniketpant / misc.sh
Created July 14, 2016 11:58
Useful terminal commands for osx
# generate a lowercase UUID
uuidgen | tr '[:upper:]' '[:lower:]'
# generate a random number between min and max
awk -v min=7000000000 -v max=9000000000 'BEGIN{srand(); print int(min+rand()*(max-min+1))}'
# copy to pasteboard after trimming endline
tr -d '\n' | pbcopy
@aniketpant
aniketpant / set-network-name.sh
Created February 25, 2016 06:25
Set network names on OSX
scutil --set ComputerName "Tekina"
scutil --set HostName "Tekina"
scutil --set LocalHostName "Aniket"
@aniketpant
aniketpant / cron_helper.sh
Created November 10, 2015 04:35 — forked from liquidgecka/cron_helper.sh
Cron helper
#!/bin/bash
usage() {
cat << EOF
Usage: $0 [OPTION]... COMMAND
Execute the given command in a way that works safely with cron. This should
typically be used inside of a cron job definition like so:
* * * * * $(which "$0") [OPTION]... COMMAND
Arguments:

Keybase proof

I hereby claim:

  • I am aniketpant on github.
  • I am aniketpant (https://keybase.io/aniketpant) on keybase.
  • I have a public key whose fingerprint is 2F57 2455 ECDD FD7D A4C0 1146 474B 065D 2C94 E490

To claim this, I am signing this object:

@aniketpant
aniketpant / Makefile
Last active August 29, 2015 14:18 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@aniketpant
aniketpant / app.go
Created March 8, 2015 16:15
Get last 50 loved tracks from Last.fm
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
)

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

<html>
<head>
<title>Select styles with CSS only</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
background-color: #fff;
font-family: helvetica, sans-serif;
margin: 4% 10%
}
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@aniketpant
aniketpant / SassMeister-input.scss
Created June 30, 2014 08:57
Generated by SassMeister.com.
// ----
// Sass (v3.3.9)
// Compass (v1.0.0.alpha.20)
// ----
$baseColor: #FFCC00;
@for $i from 1 to 5 {
#mainbody :nth-child(#{$i}) {
border-color: adjust-color($baseColor, $green: ($i - 1) * 1);