command | description |
---|---|
ctrl + a | Goto BEGINNING of command line |
This snippet of code was posted in 2014 and slightly revised in 2016 and 2017. It was more of a quick'n'dirty script than a polished tool. It is made only for Linux and in Python 2, which has since become outdated.
I currently do not use it, and I suggest you avoid it as well. Please do not expect support for using this script.
π₯ If you need an alternative, @glaucocustodio has kindly suggested EasyVPN in this comment.
The rest of the README is left for historical purposed.
# maybe.py - a Pythonic implementation of the Maybe monad | |
# Copyright (C) 2014. Senko Rasic <[email protected]> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# |
#!/usr/bin/env python | |
# | |
# Usage ./main.py <imgur_album_url> | |
# | |
from requests import get | |
from re import sub | |
from sys import argv | |
from os import listdir, mkdir, chdir |
Some notes on why Go works for me and why it might work for you if you're looking for another language to add to your repetoire. Goes without saying that this reflects my personal taste.
Go features that I particularly like
- Multicore is the future so I like that Go has concurrency built right into the core. Goroutines and channels provide a very accessible metaphor for thinking about concurrent programming. They're supported by language features that really make Go shine in this area. The select statement, for example, makes it easy to listen to and synchronise events from different concurrent threads.
- Provides both pointers and value types, but the pointers are safe and managed. Automatic memory management means its safe to return a pointer to a local variable.
- Interfaces in Go are smooth and unobtrusive. They automatically apply to anything with the right function signature so you can define interfaces that are satisfied by 3rd party code without you having to change it.
- Errors are signale
// This script loops though the list of collection names in a MongoDB and runs the compact operation on them | |
// Simply paste this into the Mongo shell | |
use testDbName; | |
db.getCollectionNames().forEach(function (collectionName) { | |
print('Compacting: ' + collectionName); | |
db.runCommand({ compact: collectionName }); | |
}); |
-
Single-line comments are started with
//
. Multi-line comments are started with/*
and ended with*/
. -
C# uses braces (
{
and}
) instead of indentation to organize code into blocks. If a block is a single line, the braces can be omitted. For example,
People
![]() :bowtie: |
π :smile: |
π :laughing: |
---|---|---|
π :blush: |
π :smiley: |
:relaxed: |
π :smirk: |
π :heart_eyes: |
π :kissing_heart: |
π :kissing_closed_eyes: |
π³ :flushed: |
π :relieved: |
π :satisfied: |
π :grin: |
π :wink: |
π :stuck_out_tongue_winking_eye: |
π :stuck_out_tongue_closed_eyes: |
π :grinning: |
π :kissing: |
π :kissing_smiling_eyes: |
π :stuck_out_tongue: |
{ | |
"always_show_minimap_viewport": true, | |
"bold_folder_labels": true, | |
"caret_style": "solid", | |
"color_scheme": "Packages/Monokai Extended/Monokai Extended.tmTheme", | |
"draw_minimap_border": true, | |
"enable_telemetry": false, | |
"ensure_newline_at_eof_on_save": true, | |
"folder_exclude_patterns": | |
[ |
try: | |
from subprocess import DEVNULL # Python 3. | |
except ImportError: | |
DEVNULL = open(os.devnull, 'wb') | |
def start_subprocess(cmd): | |
"""Run cmd (a list of strings) and return a Popen instance.""" | |
return subprocess.Popen(cmd, stdout=DEVNULL, stderr=DEVNULL) |