Skip to content

Instantly share code, notes, and snippets.

View j8's full-sized avatar
💭
I may be slow to respond.

genie j8

💭
I may be slow to respond.
View GitHub Profile
@j8
j8 / noproxy.py
Created April 15, 2020 13:01 — forked from nyov/noproxy.py
Test environment proxy settings
#!/usr/bin/env python
from __future__ import print_function
import sys, os
# This test should show how urllib.proxy_bypass_environment()
# doesn't handle proxy environment variables correctly
# on *NIX systems.
# (It does not understand IPs or CIDR notations.)
#
# For a possible solution see the `requests` library:
@j8
j8 / sketch-never-ending.md
Created December 1, 2017 09:10 — forked from Bhavdip/sketch-never-ending.md
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com

Delete the most recent commit:

git reset --hard HEAD~1

Delete the most recent commit, without destroying the work you've done:

git reset --soft HEAD~1

Adding SFTP-only user to Ubuntu Server

To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo if you're logged in as root.

Directions

  1. Edit /etc/ssh/sshd_config and make sure to add the following at the end of the file:

     Match group filetransfer
    

ChrootDirectory %h

@j8
j8 / db.js
Created May 29, 2014 09:48 — forked from anandof28/db.js
var mongoose = require('mongoose')
, Schema = mongoose.Schema;
var CloudSchema = new Schema({
'Cloud_Provider' : {type : String, required : true, trim: true},
'Lat' : {type: Number, required : true},
'Long' : {type: Number, required : true},
'Server_Type' : {type : String, required : true, trim: true},
'Memory' : {type : Number, required : true, trim: true},
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});