Skip to content

Instantly share code, notes, and snippets.

View spapas's full-sized avatar

Serafeim Papastefanos spapas

View GitHub Profile

Phoenix 1.4.x to 1.5.0 upgrade instructions

Phoenix 1.5 requires Elixir >= 1.7. Be sure your existing version is up to date by running elixir -v on the command line.

Install the new phx.new project generator

$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.5.0
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@tomdyson
tomdyson / wagtail-import-data.md
Last active February 6, 2024 03:08
Create 35k Wagtail pages of Wikipedia film plots

Create Wagtail pages programmatically

This short recipe demonstrates how to create Wagtail pages programmatically. It may also be useful for testing Wagtail development against a reasonable volume of page data (about 35,000 film plots, from English Wikipedia).

Instructions

In a virtualenv:

@defulmere
defulmere / settings.py
Last active April 30, 2024 05:34
How to override an old sqlite3 module with pysqlite3 in django settings.py
# ⚠️ USE AT YOUR OWN RISK
# first: pip install pysqlite3-binary
# then in settings.py:
# these three lines swap the stdlib sqlite3 lib with the pysqlite3 package
__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
DATABASES = {
defmodule GreekTax.Helper do
@moduledoc false
import NimbleParsec
@number [?0..?9]
def sep_number(sep) do
ascii_string(@number, 3)
|> ignore(string(sep))
|> ascii_string(@number, 5)
@sanchezzzhak
sanchezzzhak / clickhouse-get-tables-size.sql
Created January 18, 2018 13:43
clickhouse get tables size
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table
@yuvalherziger
yuvalherziger / CustomCompleter.js
Last active November 28, 2023 23:53
Sample Ace Editor custom completer
// fetch ace's language tools module:
var langTools = ace.require('ace/ext/language_tools');
// data stub:
var sqlTables = [
{ name: 'users', description: 'Users in the system' },
{ name: 'userGroups', description: 'User groups to which users belong' },
{ name: 'customers', description: 'Customer entries' },
{ name: 'companies', description: 'Legal entities of customers' },
{ name: 'loginLog', description: 'Log entries for user log-ins' },
@almet
almet / install.rst
Last active June 11, 2019 06:00
Glowing Bear + Weechat relay

Here's how to have a similar setup to irccloud, using any ssh-enabled host (this works with people.mozilla.com)

Running weechat on the server side

$ tmux
$ weechat
@johnpolacek
johnpolacek / .gitconfig
Last active April 30, 2024 06:00
My current .gitconfig aliases
[alias]
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
st = status
aa = add -A .
@lukaszb
lukaszb / Hasher.java
Last active January 19, 2024 01:35
Java implementation of Django PasswordHasher
/* Example implementation of password hasher similar to Django's PasswordHasher
* Requires Java8 (but should be easy to port to older JREs)
* Currently it would work only for pbkdf2_sha256 algorithm
*
* Django code: https://github.com/django/django/blob/1.6.5/django/contrib/auth/hashers.py#L221
*/
import java.nio.charset.Charset;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;