Skip to content

Instantly share code, notes, and snippets.

leiteg / back.html
Last active Sep 25, 2021
Anki theme with Dracula-inspired colors.
View back.html
<div class="outside"> Answer</div>
<div class="card-back shadow">
<div class="back">{{Back}}</div>
<hr />
<div class="backopt">{{BackOpt}}</div>
jimmychu0807 /
Created Nov 21, 2019
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
jotaelesalinas / git-squash.bat
Last active Apr 7, 2021
Easy git-squash (merges last N commits in one)
View git-squash.bat
@echo off
if "%1"=="" goto blank
echo Squashing %1 commits...
git reset --soft HEAD~%1
git log --format=%%B%%n --reverse "HEAD@{1}" -n %1 > _msg.txt
git commit -t _msg.txt
del _msg.txt
echo Done!

Build a scalable Twitter clone with Django and

In this tutorial we are going to build a Twitter clone using Django and, a hosted API for newsfeed development.

We will show you how easy is to power your newsfeeds with For brevity we leave out some basic Django-specific code and recommend you refer you to the Github project for the complete runnable source code. At the end of this tutorial we will have a Django app with a profile feed, a timeline feed, support for following users, hashtags and mentions.

I assume that you are familiar with Django. If you're new to Django the [official tutorial] ( explains it very well.

View build_ui.ps1
# This is a powershell commandlet equivalent of for installation on Windows
# Generate python files based on the designer ui files. pyrcc4 should be on the path.
# If you need to modify the python location or pyuic path, just change the 2 variables below
$pythonPath = "C:\Python27\"
$pyuicPath = "C:\Python27\Lib\site-packages\PyQt4\uic\"
If (!(Test-Path "designer")) {
Write-Host "Please run this from the project root"
gregmalcolm /
Last active Sep 8, 2021
Debugging C with llvm's clang and lldb

Assuming you llvm installed (comes as standard on Mac OS Mavrick xtools)

Create a helloworld.c file:

  int main()
    int x=3;
andelf / beam_decompile.erl
Created Mar 19, 2013
Erlang BEAM file decompile to .erl file
View beam_decompile.erl
#!/usr/bin/env escript
% -*- mode: erlang -*-
main([BeamFile]) ->
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]),
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]).
Alquimista /
Created Oct 9, 2011 — forked from jl2/
Draw Bezier curves using Python and PyQt
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import math
from PyQt4 import QtGui, QtCore
def binomial(i, n):