Skip to content

Instantly share code, notes, and snippets.

View z4y4ts's full-sized avatar
🎯
Focusing

Alexander Zayats z4y4ts

🎯
Focusing
View GitHub Profile
@Chandler
Chandler / slack_history.py
Last active March 26, 2024 14:35
Download Slack Channel/PrivateChannel/DirectMessage History
print("UPDATE AUG 2023: this script is beyond old and broken")
print("You may find interesting and more up to date resources in the comments of the gist")
exit()
from slacker import Slacker
import json
import argparse
import os
# This script finds all channels, private channels and direct messages
/**
* This Google Sheets script keeps data in the specified column sorted any time
* the data changes.
*
* After much research, there wasn't an easy way to automatically keep a column
* sorted in Google Sheets, and creating a second sheet to act as a "view" to
* my primary one in order to achieve that was not an option. Instead, I
* created a script that watches for when a cell is edited and triggers
* an auto sort.
*
@theskumar
theskumar / app.py
Created November 17, 2014 06:47
Database diagram using sqlalchemy
# -*- coding: utf-8 -*-
''' Generates database schema graph from a relational database.
Usages:
Add database configuation in this file and then
python app.py
Note: You must have your latest database schema in the database
engine you are running against.
'''
from __future__ import unicode_literals, absolute_import
@ChristopherA
ChristopherA / iMovieNetworkVolumeSave.md
Created July 12, 2014 21:00
How to modify Mac OSX iMovie to save projects to a network volume via terminal shell defaults write command

Saving iMovie Projects to Network Volumes

The problem

Apple's iMovie saves its Projects and Events files as folders named "/Documents/Movies/iMovie\ Events", "/Documents/Movies/iMovie\ Projects". You are not able to change this location using the app, however, you can use iMovie to move these folders to an external drive. On that drive, both of these folders MUST be at the root, i.e. "/Volumes/Footage/iMovie\ Events" and "/Volumes/Footage/iMovie\ Projects". If you open iMovie while an external drive has these folders at root, iMovie will automatically add them to its event and project library.

Unfortunately, you can't do this trick with network volumes by default. You can do some tricks with symlinks but when using them across volumes they are unreliable and iMovie will loose track of information.

The solution

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 5, 2024 18:31
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@x746e
x746e / gist:5612369
Last active December 17, 2015 12:49
better web2py devserver, with werkzeug debugger. and it doesn't rewrite translation!
diff --git a/gluon/languages.py b/gluon/languages.py
--- a/gluon/languages.py
+++ b/gluon/languages.py
@@ -283,6 +283,7 @@
def write_plural_dict(filename, contents):
+ return
if '__corrupted__' in contents:
return
@x746e
x746e / gist:4110129
Created November 19, 2012 11:03
Make web2py drop the habit of rewriting languages files
diff -r ff5196a8c552 gluon/languages.py
--- a/gluon/languages.py Wed Oct 24 14:14:55 2012 +0300
+++ b/gluon/languages.py Mon Nov 19 12:59:57 2012 +0200
@@ -283,6 +283,7 @@
def write_plural_dict(filename, contents):
+ return
if '__corrupted__' in contents:
return
@thesharp
thesharp / ML, Python and virtualenv.md
Created July 25, 2012 22:56
Quick virtualenv fix on Mountain Lion

Quick virtualenv fix on Mountain Lion

Overview

It appears that Apple somehow broke Python in Mountain Lion, so even with the latest Command Line Tools and Xcode 4.4 virtualenv won't properly work. During virtual environment creation it will try to install easy_install inside /Library hierarchy. So let's give it a quick workaround. Let's install custom python into your $HOME-directory using pythonbrew!

Installing proper Command Line Tools

Without the Apple Mac Developer account you won't even see the proper download link for the latest CL Tools and the old one won't work on ML. So here's the link: http://goo.gl/iBTXh. It points towards the Apple website so don't worry.

@x746e
x746e / and.devserver.diff
Created July 17, 2012 12:25
Make web2py show a traceback right away instead of creating a ticket and add a devserver with a reloader
diff --git a/gluon/main.py b/gluon/main.py
--- a/gluon/main.py
+++ b/gluon/main.py
@@ -796,6 +796,11 @@
log_filename,
profiler_filename) }
+ from werkzeug.serving import run_simple
+ app = app_info["wsgi_app"]
+ run_simple('localhost', 8000, app, use_reloader=True)
@hrldcpr
hrldcpr / tree.md
Last active May 1, 2024 00:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!