Skip to content

Instantly share code, notes, and snippets.

@refo
refo / createcertfilesfrompfx.sh
Created August 3, 2018 07:35
Create nginx cert files (pem, key) from pfx
#!/bin/bash
# Source:
# https://gist.github.com/ericharth/8334664
#
# Thanks:
# https://github.com/anderssonjohan
#
# Usage:
# ./createcertfilesfrompfx.sh /path/to/domain.pfx
#
@refo
refo / slugify.py
Created May 18, 2017 10:40
Automate title to slug process.
# pip install django
# pip install clipboard
# pip install unidecode
from django.template import defaultfilters
import clipboard
from unidecode import unidecode
while True:
title = input("Input title: ")
import React from 'react';
export default class ComponentName extends React.Component {
componentDidMount() {
let children = this.collectChildren(this, (child) => {
return 'object' === typeof child;
});
children = children.map(child => {
@refo
refo / Linux Notes.md
Last active February 2, 2018 12:00
Linux notes
@refo
refo / React material-ui HOCs.md
Last active February 17, 2017 12:09
React material-ui HOCs

Dependencies

yarn add material-ui
yarn add vanilla-text-mask
yarn add text-mask-addons
@refo
refo / foursquare_api_search.js
Created December 20, 2016 19:59
Foursquare Search API test
"use strict";
const
assert = require('assert'),
request = require('request'),
config = require('../config'),
_ = '';
const foursq = {
@refo
refo / bash-filepath-parts.md
Last active February 2, 2024 11:57
Extract file name / file path parts using bash

Extract given file path into its parts

Assuming, file passed as a parameter

path=$1

following script will extract file path into parts

@refo
refo / selectAll.html
Last active August 3, 2017 13:17
Javascript, select all on click
<!-- Example Usage -->
<div class="form-group col-sm-6">
<label class="control-label">Link <sup class="alert-danger">*</sup></label>
<div ng-bind="item.url" onclick="selectAll(this);" class="form-control"></div>
</div>
@refo
refo / geolocation.js
Created November 15, 2016 18:14
Javascript GeoLocation
navigator.geolocation.getCurrentPosition(function(geopos){
var coords = geopos.coords;
console.log('https://maps.google.com/?q='+coords.latitude+','+coords.longitude);
});
@refo
refo / namecheap-domains.txt
Created October 30, 2016 12:09
Namecheap scrape domain list and expiration dates
// #maincontent > div > div.dl-wrapper.normal-view > div > div:nth-child(2) > div > table > tbody:nth-child(3) > tr:nth-child(1) > td.domain-name.form > p:nth-child(2) > strong
// #maincontent > div > div.dl-wrapper.normal-view > div > div:nth-child(2) > div > table > tbody:nth-child(3) > tr:nth-child(1) > td.expiring > p > b
var list = $('#maincontent > div > div.dl-wrapper.normal-view > div > div:nth-child(2) > div > table tr.item')
.map(function(idx, item){
return {
'domain': $('td.domain-name.form > p:nth-child(2) > strong', item).text(),
'expiring': $('td.expiring > p > b', item).text()